You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a working python script which uses your pya2l module. As long as i run my script from VisualStudioCode or CMD everything is working.
But when i'm trying to generate an exe file out of my python script via PyInstaller or Nuitka, in both cases the generated exe file is not running and in the console i get the following error message. The following message is reported by the exe generated with PyInstaller. The error message from the one generated with Nuitka is, besides the filepaths, identical.
Traceback (most recent call last):
File "my_script.py", line 17, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "my_lib.py", line 5, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "my_a2l_parser.py", line 5, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "pya2l\__init__.py", line 12, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "pya2l\cli.py", line 18, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "pya2l\parser.py", line 15, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "pya2l\protobuf\API_pb2.py", line 15, in <module>
ModuleNotFoundError: No module named 'protobuf'
[10064] Failed to execute script 'my_script' due to unhandled exception!
Used versions (All packages installed via pip):
Python: 3.11.1
pya2l 0.1.2
Nuitka 2.0.1
pyinstaller 6.3.0
Looking into one of the autogenerated files, e.g. protobuf\API_pb2.py, Pylance installed with VisualStudioCode reports reportMissingImports for line 15. This fits to the error message shown above.
If i change all similar includes in all autogenerated files from e.g. from protobuf import A2L_pb2 as protobuf_dot_A2L__pb2
to from . import A2L_pb2 as protobuf_dot_A2L__pb2
i can generate working exe files with both PyInstaller and Nuitka and the Pylance warning vanishes.
For me it seems as if the script which generates the content of the protobuf folder makes an error.
Additional note:
When using PyInstaller and Nuitka you have to explicitly add a2l_grpc_windows_amd64.dll to get a working exe file. But this is not related to this issue.
The text was updated successfully, but these errors were encountered:
It seems to be a known bug/limitation, which is apparently not close from beeing fixed.
In the meanwhile, this tool has been developed to overcome this problem. Could you give it a try and give a feedback if it actually fixes the integration problem with PyInstaller?
Thanks
I adjusted every relevant import from from protobuf to from . to get it working.
But finally i decided to write my one, very reduced, A2L parser instead of using py2al because i don't want to use libraries which have to be adjusted after installation.
I have a working python script which uses your pya2l module. As long as i run my script from VisualStudioCode or CMD everything is working.
But when i'm trying to generate an exe file out of my python script via PyInstaller or Nuitka, in both cases the generated exe file is not running and in the console i get the following error message. The following message is reported by the exe generated with PyInstaller. The error message from the one generated with Nuitka is, besides the filepaths, identical.
Used versions (All packages installed via pip):
Python: 3.11.1
pya2l 0.1.2
Nuitka 2.0.1
pyinstaller 6.3.0
Looking into one of the autogenerated files, e.g. protobuf\API_pb2.py, Pylance installed with VisualStudioCode reports reportMissingImports for line 15. This fits to the error message shown above.
If i change all similar includes in all autogenerated files from e.g.
from protobuf import A2L_pb2 as protobuf_dot_A2L__pb2
to
from . import A2L_pb2 as protobuf_dot_A2L__pb2
i can generate working exe files with both PyInstaller and Nuitka and the Pylance warning vanishes.
For me it seems as if the script which generates the content of the protobuf folder makes an error.
Additional note:
When using PyInstaller and Nuitka you have to explicitly add a2l_grpc_windows_amd64.dll to get a working exe file. But this is not related to this issue.
The text was updated successfully, but these errors were encountered: