subprocess to C program
castironpi at gmail.com
Mon Dec 15 00:53:27 CET 2008
On Dec 14, 6:32 am, bobicanprogram <ican... at gmail.com> wrote:
> On Dec 13, 10:09 pm, MRAB <goo... at mrabarnett.plus.com> wrote:
> > 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.
> You might also consider using SIMPL (http://www.icanprogram.com/simpl)
> SIMPL has had a Python interface for about 5 years now. There is an
> online tutorial here. (http://www.icanprogram.com/06py/main.html)
> In one of your responses you mentioned that you were not on Unix (and
> I presume Linux). SIMPL-Python has recently been extended to work
> transparently from a Windows OS as well.
> SIMPL project coordinator
The engine uses a disk-based FIFO for interprocess. It's good if
you're looking for one- or two- way sequential.
More information about the Python-list