argilo / gr-dsd

GNU Radio block for Digital Speech Decoder
GNU General Public License v3.0
139 stars 48 forks source link

AttributeError: type object 'dsd' has no attribute 'dsd_block_ff' #16

Open m4ver1cks opened 4 years ago

m4ver1cks commented 4 years ago

When I try to use the block with Gnuradio 3.8 (In manjaro and Ubuntu) the program throw the following error.

Traceback (most recent call last): File "/home/user/pruebas/dsd/dsd.py", line 211, in main() File "/home/user/pruebas/dsd/dsd.py", line 189, in main tb = top_block_cls() File "/home/user/pruebas/dsd/dsd.py", line 142, in init self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_AUTO_DETECT,dsd.dsd_MOD_AUTO_SELECT,3,True,2) AttributeError: type object 'dsd' has no attribute 'dsd_block_ff'

g1nsj0h4n commented 3 years ago

You need to make changes as mentioned in #https://github.com/szechyjs/dsd/issues/104

You can test its working after build by running "build/python/qa_dsd_block_ff_test.sh" It should report like this:

.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK
rootabeta commented 1 year ago

You need to make changes as mentioned in #szechyjs/dsd#104

* make exitflag "extern" in dsd/include/dsd.h

* declare "int exitflag = 0;" in dsd/src/dsd_main.h before the comp function

You can test its working after build by running "build/python/qa_dsd_block_ff_test.sh" It should report like this:

.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK

I'm not convinced this is the solution. To me, this looks like an issue with the dsd module that's bundled with gr-dsd. Depending on path, dsd fails to import at all, and when it succeed, it fails to import the functions that it should. My guess is that qr-dsd seems to compile its own python library during build, which then isn't successfully loaded into the python runtime.

rootabeta@netrunner ~/Tools/gr-dsd/python ‹master› 
$ python3 qa_dsd_block_ff.py 
Traceback (most recent call last):
  File "/home/rootabeta/Tools/gr-dsd/python/qa_dsd_block_ff.py", line 12, in <module>
    from dsd import dsd_block_ff
ModuleNotFoundError: No module named 'dsd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rootabeta/Tools/gr-dsd/python/qa_dsd_block_ff.py", line 18, in <module>
    from dsd import dsd_block_ff
ModuleNotFoundError: No module named 'dsd'
lonyelon commented 1 year ago

Easily solvable by running:

cmake .. -DCMAKE_INSTALL_PREFIX="/usr/"

Instead of cmake ...

antonyenergy2 commented 9 months ago

I had same issue. I set name of project to "dsd". So when i run it i get dsd.py created and import dsd will import it istead of correct module. From what I see your file name is also dsd.py Create new project and name it differently.