Message140320
In fact, to hopefully make perfectly clear what is going on here, let me demonstrate that *any* executable statement in the module that fails to load is executed if it occurs before the error that causes the load failure:
rdmurray@hey:~/python/p32>cat temp.py
import os
print('foo:', hasattr(os, 'foo'))
try:
import temp2
except AttributeError:
print('attribute error')
print('temp2:', 'temp2' in globals())
print('foo:', hasattr(os, 'foo'))
rdmurray@hey:~/python/p32>cat temp2.py
import os
os.foo = 2
os.bar
rdmurray@hey:~/python/p32>./python temp.py
foo: False
attribute error
temp2: False
foo: True |
|
Date |
User |
Action |
Args |
2011-07-14 01:28:58 | r.david.murray | set | recipients:
+ r.david.murray, Calvin.Spealman, eric.snow |
2011-07-14 01:28:58 | r.david.murray | set | messageid: <1310606938.7.0.203712329856.issue12554@psf.upfronthosting.co.za> |
2011-07-14 01:28:57 | r.david.murray | link | issue12554 messages |
2011-07-14 01:28:57 | r.david.murray | create | |
|