英文:
Pyinstaller : .exe file doesn't work the same way as in IDE
问题
我编写了一个使用eel
作为GUI的Python脚本,用于在文件夹中进行文件的转换和一些计算。为此,我使用了一个名为asammdf
的Python库。在集成开发环境(IDE)中,代码可以正常工作,但当我使用pyinstaller
创建.exe
文件时,代码似乎无法以相同的方式运行。
import eel
from pathlib import Path
from asammdf import MDF
from pathlib import Path
import glob
import sys
import os
from datetime import timedelta
eel.init("路径\到\文件夹\Python")
def python_code():
# 使用asammdf的Python脚本
@eel.expose
我尝试将asammdf
目录复制到Python文件夹中,pyinstaller
似乎将其包括在.exe
分发文件夹中,但仍然无法正常工作。是否有人能帮助我解决这个问题?
错误消息如下:
asammdf\mdf.py:4597: UserWarning: 方法`extract_bus_logging`中的参数`ignore_invalid_signals`不再使用,将来将被移除
Traceback (most recent call last):
File "eel\__init__.py", line 281, in _process_message
File "converterrxd_csv.py", line 79, in python_code
File "asammdf\mdf.py", line 4625, in extract_bus_logging
File "asammdf\mdf.py", line 4666, in _extract_can_logging
File "asammdf\blocks\utils.py", line 1807, in load_can_database
File "canmatrix\formats\__init__.py", line 71, in loadp
File "canmatrix\formats\__init__.py", line 86, in load
KeyError: 'canmatrix.formats.dbc'
我还尝试安装can-matrix
包,但这并未解决问题。
英文:
I have written a python script, using eel
for the GUI, that converts & does some calculations on files in a folder. For this, i am using a python library called asammdf
. The code works well in an IDE but when i use pyinstaller
and create a .exe
file the code doesn't seem to work the same way.
import eel
from pathlib import Path
from asammdf import MDF
from pathlib import Path
import glob
import sys
import os
from datetime import timedelta
eel.init("path\to\folder\Python")
def python_code():
# a python script that uses asammdf
@eel.expose
I have tried copying the asammdf
directory into the python folder and pyinstaller
seems to include it in the .exe
dist folder but still it doesn't work. Can anyone help me out please?
The error message comes as --
asammdf\mdf.py:4597: UserWarning: The argument `ignore_invalid_signals` from the method `extract_bus_logging` is no longer used and will be removed in the future
Traceback (most recent call last):
File "eel\__init__.py", line 281, in _process_message
File "converterrxd_csv.py", line 79, in pythoncode
File "asammdf\mdf.py", line 4625, in extract_bus_logging
File "asammdf\mdf.py", line 4666, in _extract_can_logging
File "asammdf\blocks\utils.py", line 1807, in load_can_database
File "canmatrix\formats\__init__.py", line 71, in loadp
File "canmatrix\formats\__init__.py", line 86, in load
KeyError: 'canmatrix.formats.dbc'
I tried installing the can-matrix package as well but that doesn't solve the problem.
答案1
得分: 1
你需要添加canmatrix的隐藏导入
请查看https://github.com/danielhrisca/asammdf/blob/180a1588737ae7aaf367aaa8fd1c81aff616df16/asammdf.spec#L37
英文:
You need to add the hidden import for canmatrix
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论