[Tutor] search path

Dave Kuhlman dkuhlman at rexx.com
Sat Jul 22 19:29:23 CEST 2006


On Sat, Jul 22, 2006 at 09:57:01AM -0400, johnsonv3 wrote:
> Hi,
> 
> If one does this...
> 
> import sys
> sys.path.append("C:\\panda\direct")
> 
> Is the change to python search path only temporary?
> Thanks.

As we quibblers like to say, That depends on the meaning of the
word "temporary".

Modifications to sys.path (insert or append) last until the end of
the execution of your program.

Although there are times when modifying sys.path at run-time is
necessary, there is usually a better way.  Usually you will want
to add a path to the environment variable PYTHONPATH.  How you do
that depends on your platform (Linux, MS Windows, ...).

Dave


-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Tutor mailing list