popen from inside a thread not working!

Jeff Epler jepler at unpythonic.net
Thu Mar 11 15:34:52 CET 2004


Steve,
Must be something in your program or something different between your
environment and mine.  There's no reason why the presence of threads
would change whether stdin is a tty.

$ cat steve.py
import os, thread, time

def run_subcommand():
    os.system("tty")

def run_subcommand_in_thread():
    thread.start_new(run_subcommand, ())
    time.sleep(1) # give it plenty of time to complete...

run_subcommand()
run_subcommand_in_thread()
$ python steve.py
/dev/pts/18
/dev/pts/18

Jeff




More information about the Python-list mailing list