It worked. I don't think it's about file opening permissions, it must be something else, but it did the trick. The reason I don't think it's about permissions is that the files are different, therefore the handle shouldn't even be the same, or am I wrong in thinking so?
Don't know why I need to take this care now, I've used this script a LOT of times before and this was the first time this happened (fresh GR install on a new computer). Thanks a lot Marcus, Best Regards, Miguel 2013/12/20 Marcus Müller <mar...@hostalia.de> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Miguel, > don't shame yourself too much. We all make mistakes. > > It could be that B can't open the file it wants to write, because the > file_sink of A still has it open. After the A.stop() have an A.wait() > and an A = None. The wait call should let your program wait until all > blocks are finished and no samples are left stuck in the flowgraph > somewhere. > The None-assignment should cause Python to deconstruct A, causing Swig > to call the destructor of the C++ blocks and thus in turn should close > the file_sink's file. Sadly, Python is a modern language/runtime and > has lazy garbage collection. So in some cases, it might happen that > python decides that it should clean up later instead of instantly at > the A=None; then we still have a problem. > To solve that, you might overload your top_block's stop() method, > making sure that it calls miguels_file_sink.close() after stopping the > flowgraph: > > class detector(grc_wxgui.top_block): > ... > def stop(self): > grc_wxgui.top_block.stop(self) > self.miguels_file_sink.close() > > Hopefully, that helps. > > Greetings, > Marcus > > On 20.12.2013 00:10, Miguel Duarte wrote: > > I hope this doesn't start a new thread. I wanted to answer on my > > thread but I didn't get my own message on my inbox so.. I hope it > > works. > > > > > > I ended up getting what was wrong, and I feel ashamed on so many > > levels, I'm sorry. I was using complex data. Damn. > > > > Anyway, after changing everything, it all works as expected. So I > > delved a little into what was causing my troubles initially. > > > > It seems that my top block class "refuses" to be instanced twice, > > with two different identifiers. > > > > So let's say I have a > > > > > > class detector(grc_wxgui.top_block_gui) def __init__(self, > > options): > > > > Where I start an instance A with a certain set of options and an > > instance B with other options. > > > > I do: A = detector(options) A.start() time.sleep(x) A.stop() > > > > change options > > > > B = detector(options) B.start() time.sleep(x) B.stop() > > > > I have a file sink in the flow graph. With instance A it writes > > everything, with instance B it doesn't. Nothing is changing the top > > block, and even with the options parameter switched only A works. > > > > Is there something in this new release which prevents this from > > working? > > > > Thanks in advance, > > > > Miguel. > > > > > > > > _______________________________________________ Discuss-gnuradio > > mailing list Discuss-gnuradio@gnu.org > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.15 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQEcBAEBAgAGBQJSs+4KAAoJEAFxB7BbsDrLfgcH/1QG+/txz1x2/pUPxSB3IPOX > CMnpeRcX1k+wKkRzRjeSuuptwfGOjyaODmbzEHhKsmjLAFkgTcr1IMFogiRN6JqV > r1II7UKZQR4+49lHQ2luwLRM7S3hffsssWUQfJ29GsymXPwHN9s6cOtYVn/DxUZo > WQeI1KT06Vhf9stIDW8Cm30J9QAqtR4Jnuop+/0yR+FhO6rbcTTQLApNf0RcOpLQ > Mb22D3nxCZa3I6GOCWEDISbSfEFXYmBqpMp/zF7rskct2bdpsw0g7E5YKAiNJSrX > NJL3mEMxCghNLYxvKlZF0kZf4JREFVqbcUqZKtJQHoX2aQOjwggjdDBGl9fXMAs= > =ea9W > -----END PGP SIGNATURE----- > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio