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
#4
it turns out that sys.executable just always gives the engine path whether it was used in the command or not. there are 2 ways to run a Python script on POSIX. assuming the script is named "foo.py" and has been made executable with "chmod 755 foo.py". you can do "python3 foo.py" or "./foo.py". if "." is in the path list in the PATH environment variable then simply typing "foo.py" will also run it. what i am wanting is to determine whether the script was run directly or if the name or path to the engine was used. this could be difficult because hash-bang execution will still be running the engine and giving it the file path as the first argument and the typed arguments following that. so C level argv[] will look the same, either way. this is so i can re-run the script exactly the same way in a child process (i'm changing the arguments).
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: re-executing self with different arguments - by Skaperen - Aug-28-2019, 12:02 AM

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