A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-March/147626.html below:

[Python-Dev] Set program name through exec -a or environment variable

[Python-Dev] Set program name through exec -a or environment variable [Python-Dev] Set program name through exec -a or environment variableSerhiy Storchaka storchaka at gmail.com
Sun Mar 19 01:51:56 EDT 2017
On 18.03.17 15:15, Freddy Rietdijk wrote:
> I would like to know if you're open to supporting `exec -a` or an
> environment variable for setting `argv[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 named
> `prog`. We move the original program `prog` to `.prog-wrapped` and then
> create a wrapper `prog` that does `exec -a prog .prog-wrapped`.
>
> Unfortunately `exec -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.

You can move the original program `prog` into the subdirectory 
`.wrapped` and then create a wrapper `prog` that does `exec 
.wrapped/prog` or `exec python3 .wrapped/prog`.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4