-1

I want to open a cmd and then input data into the command line from python. I plan to call PEST calibration software to open from within python and I want to start by opening a cmd.

I am using Python 2.7 and so subprocess doesn't seem to work. I have tried os.system('cmd') and I can open the prompt but I can't input any data.

import os
os.system('cmd')
5
  • what was your subprocess code? Commented Feb 11, 2019 at 8:05
  • I tried the following: subprocess.call("cmd" + "pest", shell=True) subprocess.Popen('cmd') subprocess.run('cmd') Commented Feb 11, 2019 at 8:07
  • What is the command to run PEST calibration software, and what happens when you run the PEST command Commented Feb 11, 2019 at 8:09
  • Used to work for me on Linux, as far as I can remember, but since you're on Windows, I believe what you are looking for has been answered in this other question. Commented Feb 11, 2019 at 8:09
  • To run PEST from the cmd, I type: pest forward.pst , where pest is the name of the application and forward.pst is a text file that pest needs to open and read to run. Commented Feb 11, 2019 at 8:22

1 Answer 1

0

You should be able to pass the exact resulting string to os.system(). Ex:

os.system('notepad.exe')

In other words, os.system behaves the same way a console would.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried inputting the call I use to launch PEST in the cmd into os.system() os.system('pest forward.pst') But a prompt didn't open. It looked like a prompt may have opened but then closed so quickly I couldn't even see it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.