[wingide-users] Python path & path problems

Wingware Support support at wingware.com
Mon Jan 29 15:15:59 MST 2007


On Mon, 2007-01-29 at 14:37 -0700, SirJSR wrote:
> I am trying to use the "import" command at the interactive prompt.  I
> have simple scripts that work in the IDE, but when I go to the
> interactive shell and enter "import filename" I get a response that
> the file cannot be found:
>  
>     Traceback (most recent call last):
>   File "<string>", line 1, in <string>
> ImportError: No module named chaos
>  
> I have read as much as I can about paths, Pythonpath, etc., but I
> can't get it to work.  I also have Cygwin, and if use that shell, and
> by changing the directory to to where my scripts are located, I can
> use the "import" command successfully.
>  
> I have tried adding to my Windows XP Path variable the following:
>  
>     C:\Python25;C:\Python25\DLLs;C:\Python25\Lib;C:\Python25\Lib
> \lib-tk;C:\Python25\Lib\compiler;
>  
>     and the following directory listings to where I keep the scripts
> (they are actually in the last entry):
>  
>     C:\cygwin\bin;C:\cygwin\home\ "me-the user)";C:\cygwin\home
> \"me-user"\bin;C:\cygwin\home\"me-user)"\python;
>  
> I also created a "Pythonpath" variable:
>  
>     C:\Python25;C:\Python25\DLLs;C:\Python25\Lib;C:\Python25\Lib
> \lib-tk;C:\Python25\Lib\compiler
>  
> None of this seems to do the trick.  As you can see, I've added
> everything under the sun.  Do I need all these entries?
>  
> For informational purposes, how does the "Pythonpath" differ from the
> system path.  Is it just a subset, does it replace that part of they
> system Path, etc?  Why is it necessary?

The PATH environment variable is used by the DOS prompt and the OS in
general to find executables.  Python ignores it, so you probably
want to put it back the way it was.

The PYTHONPATH environment variable is used by Python to find *.py files
when you 'import'.  If you set this before you launch Wing and add the
directory where chaos.py is located, it should work.  However, it's
often better to set the Python Path in your Project Properties from
within Wing.

If you're trying to use things located in the cygwin file system, it may
be that the confusion is about where those get mapped to for Windows.
Normally, Wing will expect the Windows paths, as you seem to be
attempting to use.  However, if you've set your Python Executable to
your cygwin Python (rather than regular Windows installer'ed Python),
you _may_ need to use the cygwin path instead -- /home/myuser instead of
c:\cygwin\home\myuser.

Hope that helps.

-- 
Stephan Deibel

Wingware
Wing IDE for Python
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list