DIGI2-FEUP / dinasore

11 stars 12 forks source link

Broken tutorial #5

Closed fronos closed 1 year ago

fronos commented 1 year ago

Hi, I'm trying to repeat your tutorial from medium, but the dinasore fails. I've changed paths to FBs, tried to rename block. And I have no idea how to fix that... 4diac notify that "Create Function Block Instance "GENERATE_TWO_RANDOM" failed. Console output: Traceback (most recent call last): File "core/main.py", line 85, in m.build_ua_manager_fboot(address, port_opc) File "/home/bvc/dinasore/core/manager.py", line 233, in build_ua_manager_fboot self.manager_ua_fboot.from_fboot() File "/home/bvc/dinasore/data_model_fboot/ua_manager.py", line 100, in from_fboot self.config.start_work() File "/home/bvc/dinasore/core/configuration.py", line 195, in start_work outputs = self.get_fb('START').fb_obj.schedule() AttributeError: 'NoneType' object has no attribute 'fb_obj'

Error list output: [2023-01-11 16:08:20,043][ERROR][MainThread] can not import the module (check fb_type.py nomenclature) [2023-01-11 16:08:20,043][ERROR][MainThread] No module named 'resources.function_blocks.MISCELLANEOUS.pycache.EMB_RES' [2023-01-11 16:08:20,043][ERROR][MainThread] can not create the fb type: EMB_RES, instance: START [2023-01-11 16:08:20,139][ERROR][MainThread] can not find that fb START [2023-01-11 16:08:20,140][ERROR][MainThread] 'START'

fronos commented 1 year ago

This error appeared only under linux machine, under windows code works well. In my case dinasore failed due to error in functional block's path. During creation system tried to load block from pycache folder. I cure it with next lines:

        if "__pycache__" in self.root_path:
            self.root_path = self.root_path.replace('/__pycache__', '')

If you have the same problem paste it under https://github.com/DIGI2-FEUP/dinasore/blob/424abd8f66ab05aa6fa02a64fa002d502040c90d/core/fb_resources.py#L15