'exe converted from python in pyinstaller crashes
My main.py executed well in PyCharm
import cv2
from cvzone.PoseModule import PoseDetector
import json
if bboxInfo:
with open("tempCapFile.txt", 'w') as outfile:
wholeBodyCoordinate = []
x = lmList[0][1]
y = img.shape[0] - lmList[0][2]
z = lmList[0][3]
ratio = img.shape[0]/lmList[32][2]
for lm in lmList:
oneBone = {
"coord": [((lm[1])-x)*ratio,((img.shape[0] - lm[2])-y)*ratio,((lm[3])-z)*ratio]
}
wholeBodyCoordinate.append(oneBone)
jasonOutput = json.dumps(wholeBodyCoordinate)
outfile.write(jasonOutput)
if cv2.waitKey(5) & 0xFF == 27:
cap.release()
cv2.destroyAllWindows()
break
cv2.imshow("Image", img)
The procedure of conversion from .py to .exe by pyinstaller in cmd
E:\code\pythonProject\project\cvZoneTempCap>
pyinstaller -F main.py --add-binary C:\Users\adolp\anaconda3\Lib\site-packages\cv2\opencv_videoio_ffmpeg455_64.dll;
1054 INFO: PyInstaller: 5.0.1
...
316826 INFO: Building EXE from EXE-00.toc completed successfully.
However, the exe crash after executing and showing traceback message
Traceback (most recent call last):
File "main.py", line 22, in <module>
File "cvzone\PoseModule.py", line 33, in _init_
File "mediapipe\python\solutions\pose.py", 'line 146,' in _init_
File "mediapipe\python\solution_base.py", 'line 237,' in _init_
FileNotFoundError: The path does not exist.
[17872] Failed to execute script 'main' due to unhandled exception!
How can I fix this? Tell me if I am missing any information that needs to be provided.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|