import woe

Serge Orlov Serge.Orlov at gmail.com
Fri May 19 02:04:09 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?

$ cat >>~/.bashrc
export PATH=/home/foo/:$PATH
$ cat >/home/foo/application
#!/usr/bin/env python
import bar.jar
$ chmod +x /home/foo/application
$ cd /home/foo/bar
$ application
.... all imports work fine ...

> ps: i want to scale, so i do not want to edit the python path

In what sense do you want to scale, working with multiple projects or
multiple versions of one project at the same time? Anyway you are to
quick to jump to conclusions, if you don't want to edit python path who
will do it for you? Python path won't appear out of thin air if your
file layout is not supported out of the box.




More information about the Python-list mailing list