On Fri, Mar 13, 2009 at 01:49:31PM +0100, Martin Braun wrote: > Hi, > > following > http://lists.gnu.org/archive/html/discuss-gnuradio/2009-02/msg00400.html, > I tried connecting two processes with a FIFO using gr.file_descriptor_*. > > However, I can't seem to pass the file descriptor from the Python to the > C++ domain. This is the error message I get: > > gr_file_descriptor_sink: Bad file descriptor > > This is the code (pipe1 was created by using 'mkfifo pipe1'):
The python file object, fid, is going out of scope, and thus the underlying file is being closed. Try self.fid = open(...) Eric > Source-File: > > <<< SNIP >>> > from gnuradio import gr > class sig_source(gr.top_block): > def __init__(self): > gr.top_block.__init__(self) > > src = gr.sig_source_f(8000, gr.GR_SIN_WAVE, 2000, 1.0) > head = gr.head(gr.sizeof_float, 8000) > > print "Opening pipe..." > fid = open('pipe1', 'wb') > print "Done. fileno: ", fid.fileno() > sink = gr.file_descriptor_sink(gr.sizeof_float, fid.fileno()) > > self.connect(src, head, sink) > > if __name__ == '__main__': > try: > sig_source().run() > except KeyboardInterrupt: > pass _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio