Reputation: 1134
Is there a way to obtain the original argv value from python after execution code like this:
sys.argv[0]=""
In fact I search for the unwritable version of sys.argv.
I would prefer a OS independent solution, but I'm working on windows, so a windows only solution would be sufficient
Upvotes: 1
Views: 137
Reputation: 13079
On Linux you could use:
open("/proc/{}/cmdline".format(os.getpid())).read()[:-1].split("\x00")[1:]
Upvotes: 1