Catch exception on os.startfile and ask to save the file for issue590
This commit is contained in:
1 parent
2bd362beff
commit
b29cd5c208
1 file changed
+11
-1
+11
-1
@@ -267,7 +267,17 @@ def file_open(filename, type, parent, print_p=False):
|
||||
os.startfile(os.path.normpath(filename), operation)
|
||||
except:
|
||||
# Try without operation, it is not supported on version < 2.5
|
||||
os.startfile(os.path.normpath(filename))
|
||||
try:
|
||||
os.startfile(os.path.normpath(filename))
|
||||
except:
|
||||
save_name = file_selection(_('Save As...'), parent=parent,
|
||||
action=gtk.FILE_CHOOSER_ACTION_SAVE)
|
||||
if save_name:
|
||||
file_p = file(filename, 'rb')
|
||||
save_p = file(save_name, 'wb+')
|
||||
save_p.write(file_p.read())
|
||||
save_p.close()
|
||||
file_p.close()
|
||||
return
|
||||
elif os.name == 'mac' or \
|
||||
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
|
||||
|
||||
Reference in new issue
Block a user