Open stephan192 opened 8 months ago
I run into the same issue. Have you found a workaround?
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\APIpb2.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
tofrom . 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_windowsamd64.dll to get a working exe file. But this is not related to this issue.