How to add the current dir to sys.path when calling a python file?

rusi rustompmody at gmail.com
Mon Mar 18 08:35:39 CET 2013


On Mar 18, 8:56 am, Peng Yu <pengyu... at gmail.com> wrote:
> Hi,
>
> man python says "If a script  argument  is  given,  the directory
> containing the script is inserted in the path in front of $PYTHONPATH.
> The search path can be manipulated from  within a Python program as
> the variable sys.path." Instead I want to have the current directory
> inserted to the front of $PYTHONPATH without changing anything the
> script. Is there a way to do so?
>
> --
> Regards,
> Peng

Have you seen http://docs.python.org/2/library/site.html ?



More information about the Python-list mailing list