How to - import code not in current directory

Carsten Haese carsten at uniqsys.com
Thu Nov 17 08:48:09 EST 2005


On Thu, 2005-11-17 at 08:41, py wrote:
> Claudio Grondi wrote:
> > so this should work in your case:
> >
> > import sys
> > sys.path.append("C:\some\other\directory")
> > import bar
> 
> ...that will certainly work.  Only issue is that each time I start up
> foo.py in the python shell I have to retype those three lines....kind
> of why I was hoping for a environment variable or path setting that i
> could stick in.

That would be PYTHONPATH.

-Carsten





More information about the Python-list mailing list