how do I import from other directories?

Peter Rams peter.rams at sap.com
Tue Dec 17 11:11:52 EST 2002


"Gillou" <nospam at bigfoot.com> wrote in message
news:atndnt$10u7$1 at norfair.nerim.net...
> "Peter Rams" <peter.rams at sap.com> a écrit dans le message de news:
> atnb1r$gdl$1 at news1.wdf.sap-ag.de...
> > Hi,
> >
> > I want to import a module from another directory. Normally I would set a
> > path to the directory in the enviroment, but I'm running my script on
the
> > server of my provider, so I think I can't change the enviroment here.
> >
> > Is somethink like: import "/home/username/mydic/module.py" possible in
> > python?
> >
> > Thanks,
> > Peter
> >
> >
>
> 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?

Thanks,
Peter





More information about the Python-list mailing list