Message94949
I recently ran 2to3 on some of my scripts and noticed a change in behavior.
I had a script that used the built-in execfile function. After the conversion, it was
changed to manually open the file and read the contents into the exec function. Now I am
getting a SyntaxError with the modified code.
The SyntaxError is caused when the new exec code is called on a script that ends with an
empty indented line. I'm not sure if this is an error with the 2to3 script or the built-
in exec function.
I've attached a very minimal test case. The test.py file is a simple hello world script
that ends with an empty indented line. The execfile_example.py file simply calls
execfile on the test.py script. The execfile_example_converted.py file is the 2to3
converted version of execfile_example.py.
I'm running Python 2.6.2 on Windows XP. |
|
| Date |
User |
Action |
Args |
| 2009-11-06 00:08:56 | flashk | set | recipients:
+ flashk |
| 2009-11-06 00:08:56 | flashk | set | messageid: <1257466136.74.0.490341354872.issue7268@psf.upfronthosting.co.za> |
| 2009-11-06 00:08:55 | flashk | link | issue7268 messages |
| 2009-11-06 00:08:54 | flashk | create | |
|