[Python-Dev] Set program name through exec -a or environment variable (original) (raw)
Ryan Gonzalez rymg19 at gmail.com
Sat Mar 18 11:27:58 EDT 2017
- Previous message (by thread): [Python-Dev] Set program name through exec -a or environment variable
- Next message (by thread): [Python-Dev] Set program name through exec -a or environment variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
exec -a would seem to end up setting argv[0] on the CPython interpreter itself, which I don't think is the desired effect...
-- Ryan (ライアン) Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else http://refi64.com
On Mar 18, 2017 10:11 AM, "Freddy Rietdijk" <freddyrietdijk at fridh.nl> wrote:
Hi,
I would like to know if you're open to supporting
exec -a
or an environment variable for settingargv[0]
, and have some pointers as to where that should be implemented. On Nixpkgs we typically use wrappers to set environment variables like PATH or PYTHONPATH for individual programs. Consider a program namedprog
. We move the original programprog
to.prog-wrapped
and then create a wrapperprog
that doesexec -a prog .prog-wrapped
. Unfortunatelyexec -a
does not work with Python. The process is still named.prog-wrapped
(although that's not really a problem) but worse,sys.argv[0]
is also.prog-wrapped
. Currently we inject some code in programs that sets `sys.argv=[0] = "prog" but this is fragile and I would prefer to get rid of this. Kind regards, Frederik
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ rymg19%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170318/eed19cc3/attachment.html>
- Previous message (by thread): [Python-Dev] Set program name through exec -a or environment variable
- Next message (by thread): [Python-Dev] Set program name through exec -a or environment variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]