Python type error AFTER compiling to .exe

喜夏-厌秋 提交于 2020-12-26 05:14:56

问题


I have this python 3 project, running perfectly when I run it from my pycharm IDE. However when I compile it to an .exe I get an type error when executing a certain line??

I compile to exe using pip and pyinstaller. command used: pyinstaller --onefile gui.py

*ERROR I GET when executing the .exe:

Traceback (most recent call last):
  File "tkinter\__init__.py", line 1705, in __call__
  File "gui.py", line 37, in clicked
  File "passmarkDriver.py", line 48, in runPassmarkTest
TypeError: a bytes-like object is required, not 'str'```

*Line that throws the error
highSpeedTest1Sec = highSpeedTest1Sec.replace("=", " ").replace("\n", " ").replace("\r", " ")

==>You're first question will be, is this variable a bytes object? Answer, yes it is. Proof, this code runs PERFECTLY when executed from the pycharm IDE


info:
Windows 10
pip pip 20.3.3
Python: 3.7.7
Pyinstaller: 4.2.dev0

来源:https://stackoverflow.com/questions/65366404/python-type-error-after-compiling-to-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!