iFetus
iFetus

Reputation: 51

Hiding command prompt when using python

Is there a way to hide the windows command prompt or prevent it from popping up every time I us a command with python? My program loops command prompt commands causing my screen to flash with prompts.

Upvotes: 0

Views: 1218

Answers (1)

Abhijit
Abhijit

Reputation: 63707

Use subprocess.call or Popen with shell=True as an argument. Here is an example with Popen

>>> import subprocess
>>> p = subprocess.Popen('pwd', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>> output = p.stdout.read()
>>> print output
C:\Python27

Upvotes: 1

Related Questions