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
  Virtual Env changing mysql connection string in python Fredesetes 0 324 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  How do I handle escape character in parameter arguments in Python? JKR 6 1,039 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
  Using subprocess to execute complex command with many arguments medatib531 5 1,719 Apr-27-2023, 02:23 PM
Last Post: medatib531
  Question about Creating an Automated Process in Python Supratik1234 0 712 Jan-13-2023, 08:29 PM
Last Post: Supratik1234
Question log.exception() without arguments in old Python versions? cthart 5 1,117 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  Command line argument issue space issue mg24 5 1,280 Oct-26-2022, 11:05 PM
Last Post: Yoriz
  accept command line argument mg24 5 1,240 Sep-27-2022, 05:58 PM
Last Post: snippsat
  Changing a string value to a numerical value using python code and a lamda function Led_Zeppelin 6 1,539 Jul-05-2022, 11:29 PM
Last Post: deanhystad
  Python multiprocessing Pool apply async wait for process to complete sunny9495 6 6,220 Apr-02-2022, 06:31 AM
Last Post: sunny9495
  multi-line CMD in one-line python kucingkembar 5 3,861 Jan-01-2022, 12:45 PM
Last Post: kucingkembar

Forum Jump:

User Panel Messages

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