Python Forum
changing the process command line arguments in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
changing the process command line arguments in python
#1
in C i can update the argv[] strings in place with a new set of arguments and it shows up when the ps command (in Linux or Unix) shows the process command line. when i am forking child processes without doing any of the exec syscalls to reload the process, this is often a convenient way to know which process is doing what (otherwise they all appear the same way as the parent). is there a way to do this in Python? can it be made portable to work on Windows (if it has a tool to show processes).

searching on google just gets pages telling how to parse command line arguments.

i am currently updating an old program that gets some data from each AWS region. it runs a child process for each region so they are all accessed in parallel. i am taking the opportunity to improve many aspects of this old program.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
https://psutil.readthedocs.io/en/latest/#processes
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
i don't see anything in psutil that can change the argument info of itself (same process).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
It's more about looking at processes. I don't know how to change their arguments.
Look at pyrasite. It may help.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Accessing varying command line arguements Rakshan 3 172 Jul-28-2021, 03:18 PM
Last Post: snippsat
  changing Python files to .exe alok 2 235 Jul-20-2021, 02:49 PM
Last Post: alok
  How to input & output parameters from command line argument shantanu97 1 556 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Changing Index of 2 List in python giddyhead 0 424 Mar-05-2021, 05:45 PM
Last Post: giddyhead
  Automating to run python script 100 times by changing parameters pmt 1 1,010 Dec-29-2020, 10:31 AM
Last Post: andydoc
  Passing List of Objects in Command Line Python usman 7 999 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  Changing to new Python formatting example leodavinci1990 3 744 Sep-22-2020, 07:36 PM
Last Post: yaythomas
  Wait for command within a process bRitch022 1 732 Jul-15-2020, 07:03 PM
Last Post: bRitch022
  How to to tie the execution of one process to another inside a loop in Python ignorant_wanderer 0 606 Jul-11-2020, 03:44 AM
Last Post: ignorant_wanderer
  changing animation speed using buttons in python microwave 1 698 Jun-24-2020, 05:21 PM
Last Post: GOTO10

Forum Jump:

User Panel Messages

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