Chris Smith wrote:
>
> On Friday, Apr 22, 2005, at 10:00 America/Chicago, Max Noel wrote:
>
>>
>>> Do you have a suggestion as to what can I give a module so it has
>>> enough information to execute a function that resides in __main__?
>>> Here is a visual of what is going on:
>>>
>>> --__ma
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
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': ,
'y1'
Is it possible that the script is not running as __main__? Add
print __name__
to the script and see what it says...
Kent
Chris Smith wrote:
On Tuesday, Apr 19, 2005, Lee Cullens wrote:
I assume you mean PythonIDE for Python 2.3 (I usually use 2.4 and
WingIDE). Here it is (indents screwed up with
On Tuesday, Apr 19, 2005, Lee Cullens wrote:
I assume you mean PythonIDE for Python 2.3 (I usually use 2.4 and
WingIDE). Here it is (indents screwed up with var font):
HTH,
Lee C
import timeit
def y1():
print ’y1 executed’
def y2():
print ’y2 executed’
for f in [y1,y2]:
n