Importing a file that isn't in the pythonpath

Mike 'Cat' Perkonigg blablu at gmx.net
Thu Jul 13 05:37:26 EDT 2000


frr at mindless.com (Fernando Rodríguez) wrote in 
<1mfb5.61$Ve3.952 at m2newsread.uni2.es>:

>equivalent to #include "myfile.h" ).  Moving this file to some place in
>the PYTHONPATH would be inconvenient.  There must be some way to do this,
>no? O:-)

The easiest way is to put '.' in your PYTHONPATH.
But you can extend your path with any directory in your python code with:

>>>import sys
>>>sys.path.append (path-to-load-modules-from)

regards,
Mike



More information about the Python-list mailing list