问题
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