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
#1
i want to have a script re-execute itself (a few instances of itself in child processes) with different arguments. the problem i am running into is that sys.argv[0] is not always the first component of the command. if the script is not directly executable and must be run by executing the python3 engine itself with the file name of the script as the first argument, then something like subprocess.Popen([sysargv[0]]+newargs) won't execute (another instance of) the python3 engine. i don't even know where the script can find out if it was executed this way and of so, where to find how it was executed (the real C-level argv[0][] value the first instance of the engine started with).

does anyone know what needs to be done for this?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
re-executing self with different arguments - by Skaperen - Aug-18-2019, 06:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Functions (Arguments Passing,Changing a mutable ,Assignment to Arguments Names) Adelton 2 3,946 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