bastibl / gr-rds

FM RDS/TMC Transceiver
http://en.wikipedia.org/wiki/Radio_Data_System
GNU General Public License v3.0
219 stars 73 forks source link

Module 'rds' has no attribute 'parser' #26

Closed hexpwn closed 4 years ago

hexpwn commented 4 years ago

When trying to run the example code I get an error. Using gnuradio-companion 3.8, Python 3.8 and gr-rds 3.8.


Block paths:
    /home/xxxx/.grc_gnuradio
    /usr/share/gnuradio/grc/blocks
    /usr/local/share/gnuradio/grc/blocks

Loading: "/home/xxxx/3/fmradio.grc"
>>> Done

Loading: "/home/xxxx/3/fmradio_2.grc"
>>> Done

Loading: "/home/xxxx/3/gr-rds/examples/rds_rx.grc"
>>> Done

Generating: '/home/xxxx/3/gr-rds/examples/rds_rx.py'

Executing: /usr/bin/python3 -u /home/xxxx/3/gr-rds/examples/rds_rx.py

/usr/lib/python3.8/site-packages/gnuradio/qtgui/range.py:41: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  precision = len(temp) if temp is not '0' else 0
Traceback (most recent call last):
  File "/home/xxxx/3/gr-rds/examples/rds_rx.py", line 586, in <module>
    main()
  File "/home/xxxx/3/gr-rds/examples/rds_rx.py", line 564, in main
    tb = top_block_cls()
  File "/home/xxxx/3/gr-rds/examples/rds_rx.py", line 139, in __init__
    self.rds_parser_0 = rds.parser(False, False, 0)
AttributeError: module 'rds' has no attribute 'parser'

>>> Done (return code 1)
bastibl commented 4 years ago

I guess the shared library cannot be found (since the LD_LIBRARY_PATH doesn't contain the directory where the module was installed). Can you please open a Python3 console and import rds. If this also doesn't work search for rds_swig.py in the install path of the module (something like <prefix>/lib/python3.7/site-packages/rds/rds_swig.py and change the two except ImportError at the beginning to

except ImportError as e:
     print(e)
hexpwn commented 4 years ago

I can import rds in Python3.

I innitially couldn't find rds_swig.py so I made a clean install of Gnuradio (and gr-rds) and it's packages (including swig). I now have the rds_swig.py file.

I edited the two exceptions (lines 18 and 25), adding (...) as e:.

18 except ImportError as e:
19     print(e)
20     import __builtin__
25     except __builtin__.Exception as e:
26         print(e)
27         strthis = ""

Still getting the same error.

edit: by 'same error' I mean exactly the same output. The print functions did not trigger anything on the gnuradio-companion console

bastibl commented 4 years ago

This looks like an install problem, but it's hard to help since I don't know what you did. So here are some pointers:

hexpwn commented 4 years ago

Did you check that the library path (where libgnuradio-rds.so is installed) is in your search path?

It was in my search path but gnuradio libraries where not in the same directory. I moved libgnuradio-rds.so and associated files to the same dir as gnuradio and it worked!

thanks for helping me debug this. and thanks for OS'ing this project