import woe
Gary Herron
gherron at islandtraining.com
Fri May 19 01:44:11 EDT 2006
gsocks at gmail.com wrote:
>hello,
>
>i have a problem. i would like to import python files above and below
>my current directory.
>
>i'm working on /home/foo/bar/jar.py
>
>i would like to import /home/foo/car.py and
> /home/foo/bar/far.py
>
>how can i do this?
>
>thank you,
>bob
>
>ps: i want to scale, so i do not want to edit the python path
>
>
>
Work out the path name for the directory from which you'd like to
import, and append it to sys.path:
import sys
sys.path.append('..')
sys.path.append('whatever/path/absolute/or/relative')
Then off you go importing as you wish.
More information about the Python-list
mailing list