[Python-ideas] Add a command line option to adjust sys.path? (was Re: Add a site.cfg to keep a persistent list of paths)

Nick Coghlan ncoghlan at gmail.com
Sat Oct 23 16:21:09 CEST 2010

On Sat, Oct 23, 2010 at 2:55 PM, Scott Dial
<scott+python-ideas at scottdial.com> wrote:
> On 10/21/2010 2:43 AM, Nick Coghlan wrote:
>> This idea is only aimed at developers. To run an actual Python
>> application that needs additional modules, either install it properly
>> or put it in a zipfile or directory, put a __main__.py at the top
>> level and just run the zipfile/directory directly.
> If this is only aimed at developers, then those developers why isn't,
> PYTHONPATH="versionA:${PYTHONPATH}" python run_tests.py
> PYTHONPATH="versionB:${PYTHONPATH}" python run_tests.py
> , completely and utterly sufficient for the job.

Without the addition of the ability to supply a .pth file instead, I
would tend to agree with you. There's a reason I'd never actually made
the suggestion before, despite first thinking of it ages ago.
(Although, I'll also point out that your suggestion doesn't work on
Windows, which has its own idiosyncratic way of dealing with
environment variables).

The proposed command line switch would also be compatible with -E,
which is *not* the case for any approach based on modifying


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list