[Twisted-Python] A useful value for argv[0]

Bob Ippolito bob at redivi.com
Sun Feb 16 13:18:48 EST 2003

On Sunday, Feb 16, 2003, at 10:18 America/New_York, Tommi Virtanen 

> On Sun, Feb 16, 2003 at 01:22:50AM -0800, Brian Warner wrote:
>> Is there any python way to change argv[0] in place? C apps can muck 
>> with it
>> all they like.. is sys.argv[0] mutable in any useful way?
> 	C apps can't really muck with it all they like. There's a lot
> 	of limitations. In general, increasing the legth is not portably
> 	safe (without horrible kludges), and no minimum length can be
> 	guaranteed.
> 	The only simple, portable way is opportunistically resetting
> 	argv[0] if and only if the len(newValue) <= len(oldValue).

Well, can't you do it with os.execve(sys.executable, ...) ?


More information about the Twisted-Python mailing list