diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-27 22:55:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-27 22:55:27 +0000 |
commit | 1e68ac74cb516c2688e64cdc6a15480551b2f80d (patch) | |
tree | 1e78d3810e87dec71e5cb9ad08da71f1db7768f4 /Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py | |
parent | 55e45a0d588de0392d2198753e45d75cd58f9e4d (diff) |
asymptote 2.25
git-svn-id: svn://tug.org/texlive/trunk@33704 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py')
-rwxr-xr-x | Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py b/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py index 1f7ad60328f..d09196a41be 100755 --- a/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py +++ b/Master/texmf-dist/asymptote/GUI/xasyCodeEditor.py @@ -21,21 +21,26 @@ import xasyOptions def getText(text=""): """Launch the external editor""" temp = mkstemp() - tempf = fdopen(temp[0],"r+w") + tempf = fdopen(temp[0],"w") tempf.write(text) - tempf.flush() + tempf.close() try: - cmdpath,cmd = path.split(xasyOptions.options['externalEditor']) + cmdpath,cmd = path.split(path.expandvars(xasyOptions.options['externalEditor'])) split_cmd = split(cmd) cmdpart = [path.join(cmdpath,split_cmd[0])] argpart = split_cmd[1:]+[temp[1]] arglist = cmdpart+argpart call(arglist) - except: + except Exception as e: raise Exception('Error launching external editor.') - tempf.seek(0) - text = tempf.read() - remove(temp[1]) + + try: + tempf = open(temp[1],"r") + text = tempf.read() + tempf.close() + remove(temp[1]) + except Exception as e: + raise Exception('Error reading from external editor.') return text if __name__ == '__main__': |