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

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'
###

/c

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to