Message178177
When a Python file is exec()uted, it magically fails to find names in imported modules. The most magical thing in the examples below (b3.py in attach for Python 3) is that first reference to wintypes.LONG in print statement is actually successfull.
--- a.py
from ctypes import wintypes
print(wintypes.LONG)
class LOGFONT(object):
field = wintypes.LONG
--- b2.py (Python 2 version)
def main():
execfile('a.py')
main()
--- Output
<class 'ctypes.c_long'>
Traceback (most recent call last):
File "b2.py", line 4, in <module>
main()
File "b2.py", line 2, in main
execfile('a.py')
File "a.py", line 5, in <module>
class LOGFONT(object):
File "a.py", line 6, in LOGFONT
field = wintypes.LONG
NameError: name 'wintypes' is not defined |
|
Date |
User |
Action |
Args |
2012-12-26 00:15:51 | techtonik | set | recipients:
+ techtonik |
2012-12-26 00:15:50 | techtonik | set | messageid: <1356480950.95.0.0708133666827.issue16781@psf.upfronthosting.co.za> |
2012-12-26 00:15:50 | techtonik | link | issue16781 messages |
2012-12-26 00:15:48 | techtonik | create | |
|