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
<http://bugs.python.org/issue23135>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com