popen from inside a thread not working!

Steve nospam at nopes
Thu Mar 11 09:57:14 CET 2004


Hi,

I have a couple of threads running in my program and I tried to do the 
following from one thread:

out = os.popen("su -l postgres -c \"psql -c 'VACUUM ANALYZE table1' -d 
my_db\"")

This gives me the following error:

standard in must be a tty


No matter what I do, it doesn't work. I tried os.system(), os.popen2() 
etc but nothing works. Please tell me what to do! I also tried writing a 
small shell script and then calling that script from popen() but I still 
get the same error. If I try this from the main program, i.e the point 
at which I create run the threads, it works! I want the threads to be 
doing this and not the main script so please help. Thanks,


Steve




More information about the Python-list mailing list