popen2 psql

Mage mage at mage.hu
Mon May 2 12:31:27 EDT 2005


          Hello,

maybe my question is about linux and not about python.

I tried to write a proxy script for "psql" command. I need some query
log. I failed to read from the file object.

I have tested:

a,b = os.popen2('ls')
for s in b.readlines(): print s,

and:

a,b = os.popen2('./pto.py')
for s in b.readlines(): print s,

popen2 works with 'ls' but it doesn't output anything with the './pto.py'.
The 'pto.py' is an existing python script and contains some print.

Likely I have the same problem with popening the python script and the
psql binary. I can simple popen('psql').write(), but I would like to log
everything, so I need stdin and stdout files.

Please help.

       Mage





More information about the Python-list mailing list