HELP: Strange behaviour of subprocess

Pekka Niiranen pekka.niiranen at wlanmail.com
Fri Dec 31 13:53:10 CET 2004


Hi there

I have installed Cygwin to my w2k machine and use
Python to execute Bash -shell scripts. I noticed
that in script below parameter "shell=False"
causes raw_input() to fail; the only way to
stop script is to kill the Dos window where
it is run (The Bash shell runs OK listing
directory contents to screen).

Any comments anybody?

---script starts--
import os, subprocess, sys

try:
     retcode = subprocess.call("c:\\cygwin\\bin\\bash.exe -c\
	/usr/bin/ls", shell=False)
     if retcode < 0:
         print >>sys.stderr, "Child was terminated by signal", -retcode
     else:
         print >>sys.stderr, "Child returned", retcode
except OSError, e:
     print >>sys.stderr, "Execution failed:", e
raw_input("press any key")

---script ends--



More information about the Python-list mailing list