how do I import from other directories?

Fredrik Lundh fredrik at pythonware.com
Tue Dec 17 12:15:47 EST 2002


Peter Rams wrote:

> > Suppose your personal modules are in /home/me/pymodules
> >
> > import sys
> > sys.path.append('/home/me/pymodules')
> > import mymodule
> > ...
>
> thanks for the answer, but that's what I wanted to avoid because I run my
> script on the webserver of my provider and I don't know if it's possible to
> change the path there... is there another possibility? Or should it always
> be possible to change the path on a foreign websever?

sys.path is a Python list, and can be manipulated from inside the
script just like any other list.

</F>





More information about the Python-list mailing list