Skip to content Skip to sidebar Skip to footer

Error When Running Call() In Python Subprocess

i'm trying to run: try: with open(subprocess.PIPE, 'w') as pipe: call(['/usr/sbin/atms','-k'], stdout=pipe, stderr=pipe)

Solution 1:

open() is used for files, and expects a filename not a pipe.

Instead of .call(), you could use Popen:

>>> p = subprocess.Popen(['python', '-c', 'print "test"'], stdout=subprocess.PIPE)
>>> p.stdout.read()
'test\r\n'

Post a Comment for "Error When Running Call() In Python Subprocess"