Python at compile - possible to add to PYTHONPATH

rh0dium steven.klass at gmail.com
Thu Jun 22 19:07:47 EDT 2006


Hi all,

Thanks for the response.  Yeah that's what I'm currently doing but I
thought that it would be cleaner for me to append my own location at
compile time.  I'm surprised that this doesn't exist..

Thanks.



Avell Diroll wrote:
> rh0dium wrote:
> (snip)
> > I want to add /foo/bar to the PYTHONPATH build so I don't have to add
> > it later on.  Is there a way to do this?
> (snip)
>
> If i understand correctly, you want to add a directory to your
> PYTHONPATH for a specific script without modifying the system PYTHONPATH
> global variable ...
>
> To import the Gazonk() class defined in /foo/bar/baz.py without adding
> /foo/bar to PYTHONPATH you can try this:
>
> ###
>
> import sys
> sys.path.append('/foo/bar')
> 
> import baz
> quux = baz.Gazonk()
> 
> ###
> 
> hope it helped ...




More information about the Python-list mailing list