[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] File Sink - Question

From: Marcus D. Leech
Subject: Re: [Discuss-gnuradio] File Sink - Question
Date: Sat, 25 Feb 2017 12:02:56 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 02/25/2017 11:44 AM, Kevin Reid wrote:
On Sat, Feb 25, 2017 at 8:29 AM, Marcus D. Leech <address@hidden> wrote:
On 02/25/2017 11:14 AM, Kevin Reid wrote:
On Sat, Feb 25, 2017 at 8:09 AM, Ellie White <address@hidden> wrote:
    self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*512, "C:\Users\Ellie\fm_data.dat", False)

Your problem is here. Those backslashes need to be escaped in the string literal.

Since this code was generated by GRC then this would seem to be a bug in GRC, [...]
Not clear this is a bug in GRC.  Nearly all parameters in GRC blocks are simply Python expressions.

But the text entered in GRC, in this case, is not quoted, so it is not a Python _expression_. Implicitly adding quotes but not implicitly escaping backslashes is, in my opinion, an inconsistent choice.
I think that in either case, you end up failing the least-astonishment test.

If you implicitly escape "\",  then the folks who know this is Python underneath with  be unable to enter things like \x54 in a filename--which
  may be a contrived example, but you can see how automatic escaping of "\" ends up in a different type of hell than not escaping them.
  Pick your hell.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]