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

Chris Smith smichr at bigfoot.com
Fri Apr 22 03:06:47 CEST 2005

def y1():
def foo():
     from __main__ import y1

Here is a version of the code, stripped of the timeit code.  The above 
segment exhibits the same symptoms as the previously submitted one.

Even though I am running this as "__main__" it behaves as though it is 
not __main__. i.e. if I run this with pyOxide without the 'run as 
__main__' option, it generates the same ImportError ('Can't import y1') 
as it does when run in the PythonIDE.

In the pythonIDE it generates the error whether the 'run as __main__' 
option is on or off. As a test of that option, I verified that the 
following code only runs when the __main__ option is on and it worked 
as expected:

if __name__=='__main__':
	print 'running as main'


More information about the Tutor mailing list