[Tutor] No module named 'module name'
Robert Berman
bermanrl at cfl.rr.com
Sun Jan 25 21:14:59 CET 2009
Alan,
After you gave me the blatant hint to look at the system path; the
problem became obvious. Wing assigns the path of the project file to one
of the paths revealed by sys.path. I, of course, had put the project
file in the folder above my working folder.
Another learning experience.
Thank you for the key that unlocked the obvious.
Robert
Alan Gauld wrote:
> "Robert Berman" <bermanrl at cfl.rr.com> wrote
>>
>> from testwin import Ui_TestWindow
>>
>> I receive the following error message: Import error: No module named
>> testwin.
>
>> If I use ipython and do the from statement, it works just fine. I
>> think it may have something to do with a path value
>
> I think you are right!
>
> Try putting
>
> import sys
> print sys.path
>
> At the top of the file then run it from both IPython and Wing.
>
> Also try running the file from an OS prompt rather than
> from inside the IDE.
>
>> I have seen some reference to something called "Python Path", but it
>> seems to be referenced most often by Windows users
>
> Nope, PYTHONPATH applies to any OS.
> You need to use it if you have any modules in folders other than
> the default locations used by Python. I think the preferred place
> to set PYTHONPATH is in your .login script but if I'm wrong I'm
> sure a more regular *nix user will say so :-)
>
> HTH,
>
More information about the Tutor
mailing list