This looks like a bug in PythonIDE to me. I fired up my Mac and tried this in PythonIDE with Python 2.3.3:

def f():
    print 'executed f'

code = '''
print 'name:', __name__
import __main__
print dir(__main__)
from __main__ import f
f()
'''

exec code in globals(), {}

It prints
name: __main__

then a dict with no 'f' in it, then an import error.

Maybe you should try mac-sig again?

Kent

Chris Smith wrote:
From: Kent Johnson
Is it possible that the script is not running as __main__? Add
print __name__
to the script and see what it says...



It says '__main__'. Here is the end of the output after printing vars() if that helps:


'__file__': '/Users/csmith/Desktop/misc python/timeit eg.py',
't': <timeit.Timer instance at 0x1ed5dc8>,
'y1': <function y1 at 0x1eed4f0>,
'__name__': '__main__',
'y2': <function y2 at 0x1eed530>

/c

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor

Reply via email to