How to - import code not in current directory

Claudio Grondi claudio.grondi at freenet.de
Thu Nov 17 09:50:04 EST 2005


"py" <codecraig at gmail.com> schrieb im Newsbeitrag
news:1132234860.961767.209600 at z14g2000cwz.googlegroups.com...
> 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.
>
> This will do for now...
>
See the recent threads
"IDLE question" and
"newbie - How do I import automatically?"
in THIS newsgroup for further help.

Claudio





More information about the Python-list mailing list