MITHaystack / digital_rf

Read, write, and interact with data in the Digital RF and Digital Metadata formats
Other
102 stars 31 forks source link

Error with simple GRC flowgraph and digital_rf channel sink #25

Closed Infiltra closed 3 years ago

Infiltra commented 3 years ago

I made a very simple GRC flowgraph with my PlutoSDR as sink and a digital RF Channel Sink like the one below image And I got the following error,

`Generating: '/home/radio/TestDRF.py'

Executing: /usr/bin/python3 -u /home/radio/TestDRF.py

Traceback (most recent call last):
  File "/home/radio/TestDRF.py", line 159, in <module>
    main()
  File "/home/radio/TestDRF.py", line 135, in main
    tb = top_block_cls()
  File "/home/radio/TestDRF.py", line 79, in __init__
    self.gr_digital_rf_digital_rf_channel_sink_0 = gr_digital_rf.digital_rf_channel_sink(
  File "/usr/local/lib/python3.8/dist-packages/gr_digital_rf/digital_rf_sink.py", line 374, in __init__
    if LooseVersion(gr.version()) >= LooseVersion("3.7.12"):
  File "/usr/lib/python3.8/distutils/version.py", line 70, in __ge__
    c = self._cmp(other)
  File "/usr/lib/python3.8/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'

Done (return code 1)`

I installed digital_rf from the source. Some more additional information GRC Version: v3.8.2.0-78-gc4cc304c Python version: 3.8 I went into that file and saw that the gr.version is pointing to GRC versions greater than 3.7.12, which is satisfied for me. But I don't understand where this "type conversion" like the problem is happening. Should I have a lower version of python or is the problem somewhere else. And I do hope the information provided is satisfactory, if any more information is required please do tell I shall be happy to provide them.

ryanvolz commented 3 years ago

This is interesting. I guess because you've installed GNU Radio from source right off the maint-3.8 branch, it has a version string that distutils.version.LooseVersion can't parse and so it doesn't get an integer number to compare with the 3.7.12 version that it is testing against. To confirm, what is the output of python -c "from gnuradio import gr; print(gr.version())"?

It looks like we'll have to make that check more robust.

Infiltra commented 3 years ago

Hi, Thanks for the quick reply,

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/__init__.py", line 39, in <module>
    from .runtime_swig import *
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/runtime_swig.py", line 76
    def value(self) -> "PyObject *":
                    ^
SyntaxError: invalid syntax

I hope that is what you expected as a result And with python3 I get the following v3.8.2.0-78-gc4cc304c Is there any workaround for this that I can temporarily use (like giving my string version of GRC there)

ryanvolz commented 3 years ago

You wanted python3, so you can ignore the first part where Python 2 fails because your GNU Radio version doesn't support it. Otherwise, that is the result I expected and it confirms that the bug is on our end caused by how GNU Radio is reporting the version.

I've made a simple fix already that I will soon merge, but you can locally implement it by changing /usr/local/lib/python3.8/dist-packages/gr_digital_rf/digital_rf_sink.py as shown here.

Infiltra commented 3 years ago

Thank you so much for the quick fix @ryanvolz .