Generate .exe python #374
Replies: 2 comments
-
Hi, I understand you're having trouble running your Python app as an .exe generated by PyInstaller, even though it works fine in VSCode. The error you’re encountering seems to be related to the pyrfc package not being included properly in the .exe. Here are a few steps you can try to fix the issue: 1. Include Hidden Imports:
2. Update Your .spec File:
3. Check Virtual Environment: 4. Rebuild and Test:
I hope this helps resolve the issue! |
Beta Was this translation helpful? Give feedback.
-
The error occurs because
|
Beta Was this translation helpful? Give feedback.
-
Please excuse my English,
I have a python app that works fine from vscode, I can connect to SAP and retrieve information.
When I generate an .exe with pyinstaller and run it, I get the following error: (any suggestions? Thanks!!)
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "Gen_DBT_BRZ_SLV.py", line 1, in File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module File "packages\conexionSAP.py", line 1, in File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module File "pyrfc_init_.py", line 11, in File "importlib\metadata_init_.py", line 1009, in version File "importlib\metadata_init_.py", line 982, in distribution File "importlib\metadata_init_.py", line 565, in from_name importlib.metadata.PackageNotFoundError: No package metadata was found for pyrfc
.SPEC
-- mode: python ; coding: utf-8 --
from PyInstaller.utils.hooks import collect_submodules
from PyInstaller.building.api import PYZ, EXE
a = Analysis(
['C:\Automatizar_Mapeo_Campos\Gen_DBT_BRZ_SLV.py'],
pathex=['C:\Automatizar_Mapeo_Campos\packages'],
binaries=[],
datas=[
('C:\Automatizar_Mapeo_Campos\ficheros_input', 'ficheros_input'),
('C:\Automatizar_Mapeo_Campos\ficheros_output', 'ficheros_output')
],
hiddenimports=['pyrfc', 'pyodbc'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='Genbrzslv',
debug=True,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
Beta Was this translation helpful? Give feedback.
All reactions