Python Forum
re-executing self with different arguments
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
re-executing self with different arguments
#5
Skaperen Wrote:what i am wanting is to determine whether the script was run directly or if the name or path to the engine was used.
I don't think you can do that from inside the script. On the other hand you can get the pid of the current process and probably use a module such as psutil to find the command line associated to this process if any.
import psutil
print(psutil.Process().cmdline())
Reply


Messages In This Thread
RE: re-executing self with different arguments - by Gribouillis - Aug-28-2019, 12:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Functions (Arguments Passing,Changing a mutable ,Assignment to Arguments Names) Adelton 2 3,945 Mar-02-2017, 10:23 PM
Last Post: zivoni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020