Skip to content Skip to sidebar Skip to footer

I Am Unable To Interact Wih Subprocess Created By Popen

I am using python 2.5 in windows xp. In this i am using subprocess to run my shell, now how should i has to run gdb in shell using subprocess. my code: PID = subprocess.Popen('C:/S

Solution 1:

Your code:

  1. Starts STxP70.bat
  2. Writes string "gdb" (with no terminating newline) to it's standard input and closes the standard input.
  3. Is reading it's output until end of file. PID.communicate won't let you to interact with the subprocess any further—it writes the provided string and than collects all output until the process terminates.
  4. When STxP70.bat completes, the subprocess terminates.

Note, that if "shell will open" means a new window comes up with a shell prompt in it, you are screwed. It would mean the STxP70.bat stared it with 'start' command and you can't communicate with that, because it's not inheriting your stdin/stdout/stderr pipes. You would have to create your own modification of the batch that will not use 'start'.

.

Post a Comment for "I Am Unable To Interact Wih Subprocess Created By Popen"