subprocess to C program

MRAB google at mrabarnett.plus.com
Sun Dec 14 04:09:08 CET 2008


Aaron Brady wrote:
> On Dec 13, 7:51 pm, Grant Edwards <gra... at visi.com> wrote:
>> On 2008-12-14, MRAB <goo... at mrabarnett.plus.com> wrote:
>>
>>
>>
>>>> I am writing a C process and I want to read data from a file that I
>>>> write to in Python.  I'm creating a pipe in Python, passing it to the
>>>> C process, and calling '_read'.  It gives me error 9, bad file number.
> snip
>>>> meaning that 'ct' is -1, 'readfd' is 3, and 'errno' is 9.  I want 'ct'
>>>> to be 11 at this point.  Thanks in advance.
>>> It looks like the ids aren't system global.
>> They certainly aren't in Unix: Their a property of the process.
>>
>> --
>> Grant
> 
> I'm not on Unix.  It has to be possible somehow.  Do I need to set
> permissions on the IDs?  Are Stdin and Stdout my only options?  Or
> does Popen prevent sharing IDs somehow?
> 
You'd be better off using sockets.



More information about the Python-list mailing list