diff options
author | Michael Stone <michael@laptop.org> | 2007-11-09 17:11:43 (GMT) |
---|---|---|
committer | Michael Stone <michael@laptop.org> | 2007-11-09 18:11:19 (GMT) |
commit | 8bd8ec6216d208288eb2462baac5561ff38ab212 (patch) | |
tree | f996b6f427b9dddc2c1df10127357f2007e059e2 /lib | |
parent | b3fa0c001cfcff3e1f9fc5debf4cb267b87776f6 (diff) |
Improve error-handling during activity log-file creation.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sugar/activity/activityfactory.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sugar/activity/activityfactory.py b/lib/sugar/activity/activityfactory.py index 2858681..85c0832 100644 --- a/lib/sugar/activity/activityfactory.py +++ b/lib/sugar/activity/activityfactory.py @@ -28,6 +28,8 @@ from sugar.activity import registry from sugar import util from sugar import env +from errno import EEXIST + import os # #3903 - this constant can be removed and assumed to be 1 when dbus-python @@ -98,6 +100,7 @@ def get_environment(activity): environ['SUGAR_BUNDLE_ID'] = activity.bundle_id environ['SUGAR_ACTIVITY_ROOT'] = activity_root environ['PATH'] = bin_path + ':' + environ['PATH'] + #environ['RAINBOW_STRACE_LOG'] = '1' return environ @@ -127,8 +130,11 @@ def open_log_file(activity): | os.O_SYNC | os.O_WRONLY, 0644) f = os.fdopen(fd, 'w', 0) return (path, f) - except: - i += 1 + except OSError, e: + if e.errno == EEXIST: + i += 1 + else: + raise e class ActivityCreationHandler(gobject.GObject): """Sugar-side activity creation interface |