Python search path (on Windows)

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Oct 22 05:32:14 EDT 2008


En Wed, 22 Oct 2008 07:03:48 -0200, wooly booly <wb at noname.com> escribió:

> I would like to execute a Python script from Windows command line:
>
> Python myscript.py
>
> This works if myscript.py resides in the current folder. My question is:
> Is it possible to execute the command above from another folder?

Yes, use:
python path\to\the\actual\location\of\myscript.py

> I put the script's folder in the PYTHONPATH environment variable but this
> didn't help.

No, PYTHONPATH contains the directories searched when trying to import a  
module -- it's not used to locate the main script.

-- 
Gabriel Genellina




More information about the Python-list mailing list