I am working on a GUI application and I wish to convert my python code to an executable file.
The program works without any issues when run as a .py file. However, when I try to convert it into .exe with pyinstaller --onedir, it compiles my program without any errors, but when I double-click the .exe, it doesn't work. The console opens momentarily and closes immediately. There are no errors but also no GUI window.
The same issue persists even if I use auto-py-to-exe instead. I am stuck here and would appreciate any help with this. Thank you.
Edit: Instead of double-clicking the .exe, I tried running it from cmd, the error traces back till markdown folder in site-packages of my virtual environment.
exec(bytecode, module.__dict__)
File "lib\site-packages\markdown\htmlparser.py", line 30, in <module>
File "<frozen importlib._bootstrap>", line 580, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
[8788] Failed to execute script app
This part in the htmlparser.py file reads as follows:
spec = importlib.util.find_spec('html.parser')
htmlparser = importlib.util.module_from_spec(spec)
spec.loader.exec_module(htmlparser)
sys.modules['htmlparser'] = htmlparser
Note: I have (Python==3.7.9, Pyinstaller==3.6, auto-py-to-exe==2.7.8). I found a similar question here but it does not have any satisfactory responses.