[Tutor] function won't import from module

Alan G alan.gauld at freenet.co.uk
Tue Aug 9 12:22:29 CEST 2005

> I tried deleting a mycalc.pyc that had been created and the problem 
> cleared up! If I remember correctly, for a while I had moved 
> mycalc.py to another folder in PYTHONPATH (I had recently learned 
> how to modify PYTHONPATH in Win XP), and the .pyc was in this 
> folder. Sorry I don't remember clearly. But what is clear is the 
> problem cleared up immediately after deleting the .pyc. Does this 
> make sense?

Definitely. If the old pyc file was found first in the search path
then it would have been imported. If the py and pyc are inthe same 
that won't be a problem because Python will see both and check the
modification date but if it finds an isolated pyc first it will
just use that.

Alan G. 

More information about the Tutor mailing list