[Distutils] setuptools, PYTHONPATH and suExec

Phillip J. Eby pje at telecommunity.com
Wed Apr 26 22:09:30 CEST 2006

At 02:48 PM 4/26/2006 -0500, Ian Bicking wrote:
>    #!/usr/bin/env python -S
>    import sys
>    sys.path.insert(0, 'path/to/lib/python')
>    import site
>    ... other stuff ...
>I'm not 100% sure how well that #! line will work on all operating
>systems; I haven't tested this out much on different systems.

That's a BSDism, it won't work on Linux.

But this does:

     #!/path/to/python -S
     import os, sys
     paths = ["wherever"]
     os.environ["PYTHONPATH"] = os.pathsep.join(paths)
     sys.path[0:0] = paths
     import site

And this approach doesn't need workingenv either; Joe's plain setuptools 
arrangement should work with this.

I'd have suggested this first, except that I forgot that you could use -S 
and then import site afterward.

More information about the Distutils-SIG mailing list