os.popen: writing to...?

Sean Laurent slaurent at sonicfoundry.com
Wed Feb 21 22:57:44 CET 2001


On 13 Feb 2001 16:54:44 -0500, David Bolen <db3l at fitlinxx.com> wrote:

>Sean Laurent <slaurent at sonicfoundry.com> writes:
>
>> >>> instream, outstream = popen2.popen2("p4 -x - edit")
>> >>> instream
>> <open file 'p4 -x edit', mode 'r' at 017A1C88>
>> >>> outstream
>> <open file 'p4 -x edit', mode 'w' at 017A1CB0>
>> >>> outstream.write('d:\\install\\proj\\projects.xml\n')
>> Traceback (innermost last):
>>   File "<interactive input>", line 1, in ?
>> IOError: [Errno 22] Invalid argument
>> 
>> Does anyone have any bright ideas or suggestions?
<TEXT DELETED>
>Or is it possible that the child shell can't find p4 in the path or
>something?  In such a case, you might try reading first from instream
>to see the pipe is closed, or if you use popen3, checking the stderr
>handle to see if there is an error message from your shell.


Well... I'm very glad you mentioned this... *laugh*

I'm extremely embarassed to admit this, but you were right.  The child
shell could _not_ find "p4" in the path.  Plain and simple.  Staring
me right in the face.

Once I saw your suggestion to check stderr, I couldn't believe I
hadn't done that.  Lo and behold... file not found.  *grin*  The big
problem was that most of my work is done from a command prompt, where
the "p4" command is always in the path.  Unfortunately, my testing
efforts were done from PythonWin, where "p4" was _not_ in the path.

*ugh*

I greatly appreciate your advice... Thanks again.

-Sean-



More information about the Python-list mailing list