0

Problem: I need to run an external program from Python which results in a new command prompt and I need to run some commands on the new command prompt.

I have gone through some of the posts related to this:

Python subprocess - run a second command in the new command prompt created How to run multiple commands synchronously from one subprocess.Popen command?

Even I have tried with os command as:

https://www.quora.com/How-do-I-control-command-prompt-by-using-python-scripts

With


proc = subprocess.Popen(['cli', '--log=cli.log', '--log-level=debug2'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)

It seems that 'cli' is running in background and some input is awaited but when I check with ps command, no cli command exist in background and also I get error:

tcgetattr: Inappropriate ioctl for device

at command line. If I add stderr=subprocess.PIPE, the process gets existed immediately.

2
  • Did you try with shell=True? Commented Sep 18, 2019 at 11:58
  • Nothing changed even after adding shell=True Commented Sep 18, 2019 at 15:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.