The original command python line

Damjan Georgievski gdamjan at gmail.com
Sun Mar 4 01:20:28 EST 2012


>>> How can I get the *really* original command line that started my python
>>> interpreter?
> <snip>
>> On Linux, you can read from:
>>    /proc/<PID here>/cmdline
>> to get the null-delimited "command line".
> 
> After some further searching:
> psutil offers `Process.cmdline` cross-platform;
> see http://code.google.com/p/psutil/wiki/Documentation

Indeed, changing for

	args = psutil.Process(os.getpid()).cmdline

in the above example does solve the problem, at least in Linux.


> Sidenote: Consensus generally seems to be that relative imports are a
bad idea.

How come?
I'm using explicit relative imports, I thought they were the new thing?


-- 
damjan



More information about the Python-list mailing list