Problems with Gnuradio-Companion

Hi everyone

How does gnuradio-companion find and recognise blocks?

Why is it so damned difficult for a normal person to write and maintain
a
block?

I had developed a working block written which functioned fine, even in
gnuradio-companion. I needed an extra parameter so I added this. I
modified
all the appropriate files that I know about in lib, include and so on to
include the extra parameter input. The modified block compiles without
errors and it installs and works fine. I have done a sudo ldconfig. It
even
works and so do previous Python scripts that use it.

BUT Gnuradio Companion absolutely and completely refuses to find it.
Error -
block key not found in platform. Its not in the list of blocks, its just
gone.

Is the XML file there? yes. Is it properly configured? Yes. Are all the
other files in the right places? Yes - it would appear so by comparison
with
other blocks. No doubt there is some config file somewhere expecting my
block to have one less parameter hiding in a directory with a curious
name
where its obvious to developers but not to mere mortals. Has GRC has
looked
is some such place, noted a difference and silently ignored the block
completely? Three hours I have been bashing away at this and have got
nowhere.


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Thanks to Sebastian for his help.

This appears to be a bug? Well maybe my bug. My input parameter was
intended
as an identification number and not unreasonably I called it “id”.
Apparently I can’t call the parameter “id”. I can call it “ix” and grc
will
find it. What on earth?

Mike

On Sat, Nov 22, 2014 at 11:08 AM, Mike W. [email protected]
wrote:

$ ipython

In [1]: help(id)

Help on built-in function id in module builtin:

id(…)
id(object) → integer

Return the identity of an object.  This is guaranteed to be unique 

among
simultaneously existing objects. (Hint: it’s the object’s memory
address.)

GRC runs in Python. It outputs Python code. You tried to use a reserved
Python keyword.

Tom

On 11/22/2014 12:07 PM, Tom R. wrote:

id(object) -> integer

Tom

It is theoretically possible for GRC to identify “stuff” that will
later cause you problems at runtime due to Pythonisms. But that would
vastly
increase GRC’s complexity, and it would be error-prone, and “false
positive” rather a lot, it’s simply not practical. GRC could also have
its own
“language” for evaluating expressions, rather than use Python. That
would come with its own set of surprises and gotchas, so, better to use
a language that is already well-developed, well-understood, and with
well-defined semantics.

There’s no real way to get around the fact that, at the end of the day,
you’re programming, and thus run into all the same “gotchas” that
“conventional” (is there such a thing any more) programmers run into.

Hi Tom

Thanks for spotting this one.

There isn’t anything in the documentation on it. No doubt it would be
obvious to python developers and it is assumed we all know, but I wonder
if that is true? Especially as we are writing to XML describing the
interface to a C++ program.

Now I know I am not very clever but how would I know what are reserved
python codes? It would be obvious to a c programmer not to call
something float or int, from, for class and so on.

I looked up on the web for reserved python keywords:

Reserved Words

You may not name your variables any of the following words as they mean
special things in Python:

and

assert

break

class

continue

def

del

elif

else

except

exec

finally

for

from

global

if

import

in

is

lambda

not

or

pass

print

raise

return

try

while

Do NOT use any of the following words either (although they are not
strictly Python reserved words, they conflict with the names of
commonly-used Python functions):

Data

Float

Int

Numeric

Oxphys

array

close

float

int

input

open

range

type

write

zeros

You should also avoid all the names defined in the math library (you
must avoid them if you import the library):

acos

asin

atan

cos

e

exp

fabs

floor

log

log10

pi

sin

sqrt

tan

I would never have guessed not to use lambda. It is just the sort of
thing I might chose for a wavelength input but “id” is not one of these.
It’s a function:

https://docs.python.org/3.3/library/functions.html#abs abs()

https://docs.python.org/3.3/library/functions.html#func-dict dict()

https://docs.python.org/3.3/library/functions.html#help help()

https://docs.python.org/3.3/library/functions.html#min min()

https://docs.python.org/3.3/library/functions.html#setattr setattr()

https://docs.python.org/3.3/library/functions.html#all all()

https://docs.python.org/3.3/library/functions.html#dir dir()

https://docs.python.org/3.3/library/functions.html#hex hex()

https://docs.python.org/3.3/library/functions.html#next next()

https://docs.python.org/3.3/library/functions.html#slice slice()

https://docs.python.org/3.3/library/functions.html#any any()

https://docs.python.org/3.3/library/functions.html#divmod divmod()

https://docs.python.org/3.3/library/functions.html#id id()

https://docs.python.org/3.3/library/functions.html#object object()

https://docs.python.org/3.3/library/functions.html#sorted sorted()

https://docs.python.org/3.3/library/functions.html#ascii ascii()

https://docs.python.org/3.3/library/functions.html#enumerate
enumerate()

https://docs.python.org/3.3/library/functions.html#input input()

https://docs.python.org/3.3/library/functions.html#oct oct()

https://docs.python.org/3.3/library/functions.html#staticmethod
staticmethod()

https://docs.python.org/3.3/library/functions.html#bin bin()

https://docs.python.org/3.3/library/functions.html#eval eval()

https://docs.python.org/3.3/library/functions.html#int int()

https://docs.python.org/3.3/library/functions.html#open open()

https://docs.python.org/3.3/library/functions.html#func-str str()

https://docs.python.org/3.3/library/functions.html#bool bool()

https://docs.python.org/3.3/library/functions.html#exec exec()

https://docs.python.org/3.3/library/functions.html#isinstance
isinstance()

https://docs.python.org/3.3/library/functions.html#ord ord()

https://docs.python.org/3.3/library/functions.html#sum sum()

https://docs.python.org/3.3/library/functions.html#bytearray
bytearray()

https://docs.python.org/3.3/library/functions.html#filter filter()

https://docs.python.org/3.3/library/functions.html#issubclass
issubclass()

https://docs.python.org/3.3/library/functions.html#pow pow()

https://docs.python.org/3.3/library/functions.html#super super()

https://docs.python.org/3.3/library/functions.html#bytes bytes()

https://docs.python.org/3.3/library/functions.html#float float()

https://docs.python.org/3.3/library/functions.html#iter iter()

https://docs.python.org/3.3/library/functions.html#print print()

https://docs.python.org/3.3/library/functions.html#func-tuple tuple()

https://docs.python.org/3.3/library/functions.html#callable
callable()

https://docs.python.org/3.3/library/functions.html#format format()

https://docs.python.org/3.3/library/functions.html#len len()

https://docs.python.org/3.3/library/functions.html#property
property()

https://docs.python.org/3.3/library/functions.html#type type()

https://docs.python.org/3.3/library/functions.html#chr chr()

https://docs.python.org/3.3/library/functions.html#func-frozenset
frozenset()

https://docs.python.org/3.3/library/functions.html#func-list list()

https://docs.python.org/3.3/library/functions.html#func-range range()

https://docs.python.org/3.3/library/functions.html#vars vars()

https://docs.python.org/3.3/library/functions.html#classmethod
classmethod()

https://docs.python.org/3.3/library/functions.html#getattr getattr()

https://docs.python.org/3.3/library/functions.html#locals locals()

https://docs.python.org/3.3/library/functions.html#repr repr()

https://docs.python.org/3.3/library/functions.html#zip zip()

https://docs.python.org/3.3/library/functions.html#compile compile()

https://docs.python.org/3.3/library/functions.html#globals globals()

https://docs.python.org/3.3/library/functions.html#map map()

https://docs.python.org/3.3/library/functions.html#reversed
reversed()

https://docs.python.org/3.3/library/functions.html#__import__
import()

https://docs.python.org/3.3/library/functions.html#complex complex()

https://docs.python.org/3.3/library/functions.html#hasattr hasattr()

https://docs.python.org/3.3/library/functions.html#max max()

https://docs.python.org/3.3/library/functions.html#round round()

https://docs.python.org/3.3/library/functions.html#delattr delattr()

https://docs.python.org/3.3/library/functions.html#hash hash()

https://docs.python.org/3.3/library/functions.html#func-memoryview
memoryview()

https://docs.python.org/3.3/library/functions.html#func-set set()

Somewhere in the documentation, it would be really useful to have a list
of reserved words and function names we can’t use, or even better some
checking of the XML to warn people. It ought to be clear from the
context that a user is not attempting to call a python function in
describing a variable name.

It is probably also the case that any function in any library that is
imported is also not usable.

Mike

From: [email protected] [mailto:[email protected]] On Behalf Of
Tom R.
Sent: 22 November 2014 17:08
To: Mike W.
Cc: GNURadio D.ion List
Subject: Re: [Discuss-gnuradio] Problems with Gnuradio-Companion

On Sat, Nov 22, 2014 at 11:08 AM, Mike W. <[email protected]
mailto:[email protected] > wrote:

Thanks to Sebastian for his help.

This appears to be a bug? Well maybe my bug. My input parameter was
intended as an identification number and not unreasonably I called it
“id”. Apparently I can’t call the parameter “id”. I can call it “ix” and
grc will find it. What on earth?

Mike

$ ipython

In [1]: help(id)

Help on built-in function id in module builtin:

id(…)

id(object) -> integer



Return the identity of an object.  This is guaranteed to be unique 

among

simultaneously existing objects.  (Hint: it's the object's memory 

address.)

GRC runs in Python. It outputs Python code. You tried to use a reserved
Python keyword.

Tom