[Python-Dev] Question about sys.path and sys.argv and how packaging (may) affects default values

Brett Cannon brett at python.org
Wed Mar 2 12:19:46 EST 2016


On Wed, 2 Mar 2016 at 09:12 Michael Felt <aixtools at gmail.com> wrote:

> Hello all,
>
> 1) There are many lists to choose from - if this is the wrong one for
> questions about packaging - please forgive me, and point me in the right
> direction.
>

So in this instance you're after python-list since this is a general
support question. But since I have an answer for you...


>
> 2) Normally, I have just packaged python, and then moved on. However,
> recently I have been asked to help with packaging an 'easier to install'
> python by people using cloud-init, and more recently people wanting to
> use salt-stack (on AIX).
>
> FYI: I have been posting about my complete failure to build 2.7.11 (
> http://bugs.python.org/issue26466) - so, what I am testing is based on
> 2.7.10 - which built easily for me.
>
> Going through the 'base documentation' I saw a reference to both
> sys.argv and sys.path. atm, I am looking for an easy way to get the
> program name (e.g., /opt/bin/python, versus ./python).
> I have my reasons (basically, looking for a compiled-in library search
> path to help with http://bugs.python.org/issue26439)
>

https://docs.python.org/2.7/library/sys.html#sys.executable


>
> Looking on two platforms (AIX, my build, and debian for power) I am
> surprised that sys.argv is empty in both cases, and sys.path returns
> /opt/lib/python27.zip with AIX, but not with debian.
>

Did you actually build your version of Python on Debian? If not then do
realize that Debian patches their version of CPython, so it wouldn't shock
me if they stripped out the code that adds the zip file to sys.path. IOW
don't trust the pre-installed CPython to act the same as one that is built
from source.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160302/971fe53a/attachment.html>


More information about the Python-Dev mailing list