popen2.popen2,3,4 from Python 2.0 on NT 4.0 SP5

Mark Hammond MarkH at ActiveState.com
Wed Oct 25 20:23:34 EDT 2000


Are you using a standard command interpreter (ie, cmd.exe)

Eg, I try your exact code ('sqlplus' isnt installed here, so it
fails):

Python 2.0 (#5, Sep 12 2000, 14:13:44) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import popen2
>>> x=popen2.popen3('sqlplus pf/pf at dds230pf3 @rowcount.sql')
>>> x[0].readline()
''
>>> x[0].readline()
''

So I have no idea why a simple test of a command failing doesnt work
for you?

> 1.  Why does it hang?  This seems like a bug.  It should return with
> some known response, or nothing.

No idea.

> 2.  Is there a way to find out how many characters are left in the
> stdout/stderr buffers?

Umm - can't recall if a portable way exists?  However, you should
definitely not get hangs.

> 3.  This test is for winnt.  Is unix different, and should I use
> win32all to workaround (I would rather not, if possible)?

win32all has the exact same code as python 2.0 for this.

> 4.  Should I use threading, and use another thread to see when the
> readline() fails to return (messy)?
> 5.  Is this a shelled process state problem, or a buffer state
problem?
> 6.  Does this problem throw any exception?

It simply shouldn't behave like this, and I don't believe it will for
most other people.

Actually - my testing is Win2k - maybe some other NT4 users can chime
in (although I imagine they must be getting rarer - win2k is much
nicer)

Mark.






More information about the Python-list mailing list