[New-bugs-announce] [issue23135] import searchpaths as arguments

c2621566 report at bugs.python.org
Tue Dec 30 20:10:31 CET 2014


New submission from c2621566:

This patch allows specifying import searchpaths as `-p path` arguments to the interpreter, without touching environment variables.

Avoiding environment variables simplifies a script of mine and is a portable way of swapping module implementation without touching the importing script.

e.g.
# python -p ~/.bin/customlib -p ~/.bin/other script.py
is equivalent to
# PYTHONPATH=~/.bin/customlib:~/.bin/other:$PYTHONPATH python script.py
similarly to
# ghci -i.bin/customlib:.bin/other foo.hs

It is implemented by prepending the arguments to sys.path in Py_Main just after Py_Initialize is called.

----------
components: Interpreter Core
files: main.c.searchpatharg1.diff
keywords: patch
messages: 233216
nosy: c2621566
priority: normal
severity: normal
status: open
title: import searchpaths as arguments
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37567/main.c.searchpatharg1.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23135>
_______________________________________


More information about the New-bugs-announce mailing list