Message135170
PyZipFile.writepy gives internal error on syntax errors in files it processes.
For example, in the attached test case:
Traceback (most recent call last):
File "C:\tfs\SDKS\python\Python32\lib\py_compile.py", line 119, in compile
optimize=optimize)
File "test_zipfile_error_bad_syntax.py", line 1
syntax error
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1393, in _compile
py_compile.compile(file, doraise=True, optimize=optimize)
File "C:\tfs\SDKS\python\Python32\lib\py_compile.py", line 123, in compile
raise py_exc
py_compile.PyCompileError: File "test_zipfile_error_bad_syntax.py", line 1
syntax error
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test_zipfile_error.py", line 7, in <module>
pzf.writepy(PYFILE)
File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1376, in writepy
fname, arcname = self._get_codename(pathname[0:-3], basename)
File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1428, in _get_codename
if _compile(file_py):
File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1395, in _compile
print(err.msg)
NameError: global name 'err' is not defined
Around zipfile.py:1395
in PyZipFile._get_codename _compile
try:
py_compile.compile(file, doraise=True, optimize=optimize)
except py_compile.PyCompileError as error:
print(err.msg)
return False
The print should be printing error.msg not err.msg |
|
Date |
User |
Action |
Args |
2011-05-05 02:27:20 | Ben.Morgan | set | recipients:
+ Ben.Morgan |
2011-05-05 02:27:20 | Ben.Morgan | set | messageid: <1304562440.9.0.83817194423.issue12004@psf.upfronthosting.co.za> |
2011-05-05 02:27:20 | Ben.Morgan | link | issue12004 messages |
2011-05-05 02:27:19 | Ben.Morgan | create | |
|