don't understand popen2
Martin P. Hellwig
mhellwig at xs4all.nl
Thu Mar 23 03:28:53 EST 2006
Donn Cave wrote:
<cut>
>
> Anyway, it seems unlikely he would get that INVARG error for this
> reason. That's an error from the host operating system, not the
> interpreter, and it mostly likely refers to the file descriptor.
> Since it works for me, I guess his problem is basically this:
>
> |> (python 2.4 + win32 extensions on XPProSP2)
>
> Donn Cave, donn at drizzle.com
Thank you for your suggestion.
I shuffled it a bit around and executed it on my BSD box and there
indeed it works, if I use that exactly program (well not the path var of
course) on NT it has no error but it still not gives the expected
results. So I guess that pipes,std-in, std-out & std-err work that
different on NT then on other POSIX systems.
The lucky thing is that the code where I am exercising for must run on a
BSD system so my immediately problem is dealt with, but I'm still
curious how to get this working on NT.
I posted my new code and the results under my sep.
--
mph
popen_test.py------------------------------------
#! /usr/local/bin/python
import popen2
std_out, std_in = popen2.popen2("F:\coding\pwSync\popen_test\testia.py")
std_in.writelines("test\n")
std_in.flush()
std_in.close()
x=std_out.readlines()
print(x)
-------------------------------------------------
testia.py----------------------------------------
#! /usr/local/bin/python
someline = raw_input("something:")
if someline == 'test':
print("yup")
else:
print("nope")
-------------------------------------------------
results on NT:
F:\coding\pwSync\popen_test>popen_test.py
[]
results on BSD:
%./popen_test.py
['something:yup\n']
%
More information about the Python-list
mailing list