Hello Vasil,
Thank you for your help. Editing python/__init__.py did solve my current problem: After changing the exception handling to the following I was able to move on to other issues while porting. try: # this might fail if the module is python-only from .myModule_python import * except ImportError: dirname, filename = os.path.split(os.path.abspath(__file__)) __path__.append(os.path.join(dirname, "bindings")) from . myModule _python import * except ModuleNotFoundError: dirname, filename = os.path.split(os.path.abspath(__file__)) __path__.append(os.path.join(dirname, "bindings")) from . myModule_python import * Re-installing my module gave me this cmake error: CMake Error at lib/CMakeLists.txt … Target “gnuradio-myModule” links to: gnuradio::gnuradio-fec but the target was not found. I was able to solve this by removing the gnuradio:: qualifier from gnuradio-fec and gnuradio-analog. For some reason, only gnuradio-fec but not gnuradio::gnuradio-fec is known. Could this be an unintended bug? Under Gnu Radio 3.8.5 gnuradio::gnuradio-fec was able to be found. But right now I’m struggling with a new problem that I’m unable to solve: Calling import myModule_python in gr-myModule/build/python/myModule/bindings/ throws a segmentation fault which gets traced back to /usr/local/lib/python3.10/dist-packages/gnuradio/gr/__init__.py The line responsible for the segfault is: log.set_level(prefs().get_string("LOG", "log_level", "notset")) Context for the line: log = gr.logger("log") log.set_level(prefs().get_string("LOG", "log_level", "notset")) log_debug = gr.logger("log_debug") Again I would be very thankful if someone could help me. Thank you and regards, Luca >-----Ursprüngliche Nachricht----- >Von: Vasil Velichkov <vvvelich...@gmail.com> >Gesendet: Freitag, 9. September 2022 15:06 >An: Bachmaier, Luca <luca.bachma...@iis.fraunhofer.de>; discuss- >gnura...@gnu.org >Betreff: Re: Struggling with 3.10 OOT Module Porting: AttributeError: module >has no attribute > >Hi Luca, > >On 09/09/2022 10.58, Bachmaier, Luca wrote: >> Dear all, >> >> I'm currently porting some of my modules from GNU Radio 3.8 to 3.10 and >experiencing issues with (probably) pybind. My system setup is: Debian 11, >GNU Radio 3.10.3.0. >> >> My flow graphs that include the 3.8 modules are able to compile, but are not >able to run due to the following error: >> File "home/user/.grc_gnuradio/myModule_sync.py", line 56 in >__init__ >> Self.myModule_myblock_0 = myModule.myblock(0, 0) >> AttributeError: module 'myModule' has no attribute 'myblock' > >Open `python/__init__.py`, check if there is `except ImportError:` and replace >it with `except ModuleNotFoundError:`, then reinstall and try again. > >See also https://github.com/gnuradio/gnuradio/issues/3884 > >Regards, >Vasil