Python Forum
how to get PID's of linux commands executed through python modules?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get PID's of linux commands executed through python modules?
#4
(Mar-12-2020, 07:03 AM)Manikandan_PS Wrote: i am not able to read this output through subprocess.Popen, os.popen and commands.getstatusoutput. commands give error as "syntax error near unexpected token '&' and others give empty string as output and command is running the background successfully though.
Maybe show your code...

(Mar-12-2020, 07:03 AM)Manikandan_PS Wrote: subprocess.Popen gives a pid but when killed or terminated i could still see the tail and egrep pid's staying alive.
Do you pass shell=True? in which case as docs state:
Quote:Note that if you set the shell argument to True, this is the process ID of the spawned shell.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: how to get PID's of linux commands executed through python modules? - by buran - Mar-12-2020, 07:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [Linux] Run Python script through cron? Winfried 2 1,227 Oct-19-2024, 06:29 PM
Last Post: Winfried
Bug Python 3.12 cannot import local python files as modules sunflowerdog 25 19,421 Jul-31-2024, 01:52 PM
Last Post: sunflowerdog
  Linux, Python, C ++, Brain2 and errors. PiotrBujakowski 0 984 Jun-24-2024, 03:41 PM
Last Post: PiotrBujakowski
  Is possible to run the python command to call python script on linux? cuten222 6 2,370 Jan-30-2024, 09:05 PM
Last Post: DeaD_EyE
  How to not open the context menu if a mouse gesture is executed? MicheliBarcello 2 1,422 Aug-22-2023, 02:47 PM
Last Post: deanhystad
  return next item each time a function is executed User3000 19 5,548 Aug-06-2023, 02:29 PM
Last Post: deanhystad
  code not working when executed from flask app ThomasDC 1 3,329 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  How to see the date of installation of python modules. newbieAuggie2019 4 4,551 Mar-31-2023, 12:40 PM
Last Post: newbieAuggie2019
  Python modules for accessing the configuration of relevant paths Imago 1 2,431 May-07-2022, 07:28 PM
Last Post: Larz60+
  How to use a variable in linux command in python code? ilknurg 2 2,399 Mar-14-2022, 07:21 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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