Message92966
On Python 2.6.2, and possibly other versions, in the traceback module,
format_exception_only does not behave correctly when printout out a
SyntaxError. An extra newline is inserted before the carot. E.g.
38 exceptionType, exceptionValue, exceptionTraceback =
sys.exc_info()
39 sys.stderr.write("Exception:\n")
40 ex = traceback.format_exception_only(exceptionType,
exceptionValue)
41 sys.stderr.write(repr(ex))
42 for line in ex:
43 sys.stderr.write(line)
yields, e.g.
Exception:
[' File "/home/matt/apps/posac/source/posac/posac_main.py", line 12\n',
' def run()\n', ' \n^\n', 'SyntaxError: invalid syntax\n']
File "/home/matt/apps/posac/source/posac/posac_main.py", line 12
def run()
^
SyntaxError: invalid syntax
When it should be:
Exception:
[' File "/home/matt/apps/posac/source/posac/posac_main.py", line 12\n',
' def run()\n', ' ^\n', 'SyntaxError: invalid syntax\n']
File "/home/matt/apps/posac/source/posac/posac_main.py", line 12
def run()
^
SyntaxError: invalid syntax
Attached is a patch. This patch has been tested on gentoo linux. |
|
Date |
User |
Action |
Args |
2009-09-21 22:26:52 | thewtex | set | recipients:
+ thewtex |
2009-09-21 22:26:52 | thewtex | set | messageid: <1253572012.9.0.846902756749.issue6962@psf.upfronthosting.co.za> |
2009-09-21 22:26:51 | thewtex | link | issue6962 messages |
2009-09-21 22:26:51 | thewtex | create | |
|