Re: [Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-05-03 Thread Feziwe Mpondo
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

Re: [Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-22 Thread Kent Johnson
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

Re: [Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-21 Thread Chris Smith
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'

Re: [Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-21 Thread Kent Johnson
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

[Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-20 Thread Chris Smith
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