Message178180
The fact that the print works should be a clue that Python is in fact finding the module and importing it. So your problem actually has to do with namespaces, which is something you have to think about when using exec or execfile. You can see this by replacing your import with any variable setting (say, a=1) and referencing that in the class body.
The problem here is that execfile is operating inside a function, therefore the local and global namespaces are different. wintypes gets imported into the *local* namespace.
Now, if you inline this type of code by hand, wintypes (or a) is found in the local namespace when the class statement is executed. But when it is done via execfile, it is not.
I'm not clear on whether or not this is a bug, but if it isn't there is certainly missing documentation in the description of execfile. |
|
Date |
User |
Action |
Args |
2012-12-26 01:25:04 | r.david.murray | set | recipients:
+ r.david.murray, techtonik, benjamin.peterson |
2012-12-26 01:25:04 | r.david.murray | set | messageid: <1356485104.3.0.927007765197.issue16781@psf.upfronthosting.co.za> |
2012-12-26 01:25:04 | r.david.murray | link | issue16781 messages |
2012-12-26 01:25:02 | r.david.murray | create | |
|