On Dec 13, 9:09 pm, MRAB <goo...@mrabarnett.plus.com> wrote: > Aaron Brady wrote: > > On Dec 13, 7:51 pm, Grant Edwards <gra...@visi.com> wrote: > >> On 2008-12-14, MRAB <goo...@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.
I got the 'stdin' solution to work. The Python end worked fine. I just had to use the 'getchar' function instead of '_getch' function on the C end. Not obvious, I guess. Ideally, I could block on input from the console and stdin individually. -- http://mail.python.org/mailman/listinfo/python-list