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

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Mar 18 19:12:07 EDT 2017


Oleg Broytman wrote:
> On Sat, Mar 18, 2017 at 10:27:58AM -0500, Ryan Gonzalez <rymg19 at gmail.com> wrote:
> 
>>exec -a would seem to end up setting argv[0] on the CPython interpreter
>>itself, which I don't think is the desired effect...
> 
>    That's exactly what OP asked -- how to change that?

Maybe python itself should have an -a option, so that

    python -a blarg foo.py

would run foo.py with sys.argv[0] == 'blarg'.

-- 
Greg


More information about the Python-Dev mailing list