![]() |
convert a .py file to .exe file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: convert a .py file to .exe file (/thread-22643.html) Pages:
1
2
|
convert a .py file to .exe file - vigneshboolog - Nov-21-2019 Hi i made a pyttsx3 python program which is executed in the run-time but when i convert it into exe it doesn't work. my code was:- [ import pyttsx3 engine = pyttsx3.init() engine.setProperty('rate',120) engine.say('hello how are you') engine.runAndWait() ] then i used pyinstaller to convert it. RE: convert a .py file to .exe file - Axel_Erfurt - Nov-21-2019 (Nov-21-2019, 04:40 AM)vigneshboolog Wrote: then i used pyinstaller to convert it. which command did you use? RE: convert a .py file to .exe file - vigneshboolog - Nov-23-2019 pyinstaller filename.py RE: convert a .py file to .exe file - Evil_Patrick - Nov-23-2019 try auto-py-to-exe RE: convert a .py file to .exe file - vigneshboolog - Nov-23-2019 tried that to RE: convert a .py file to .exe file - buran - Nov-23-2019 probably pyinstaller failed to find some hidden imports https://pythonhosted.org/PyInstaller/when-things-go-wrong.html RE: convert a .py file to .exe file - snippsat - Nov-23-2019 Did a test you most include drivers.sapi5 .Here is the spec file,you can run it bye using: pyinstaller --clean talk_fix.spec talk.py is your code talk_fix.spec is spec file posted under. Change pathex to folder you run from. # -*- mode: python ; coding: utf-8 -*- block_cipher = None a = Analysis(['talk.py'], pathex=['E:\\div_code\\forum_env'], binaries=[], datas=[], hiddenimports=["pyttsx3", "pyttsx3.drivers.sapi5"], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='talk', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True ) RE: convert a .py file to .exe file - vigneshboolog - Nov-28-2019 1) I added the drivers.sapi5 line to my code 2) Then i made a spec file with code above in the same folder 3) The in command line i entered pyinstaller --clean talk_fix.spec 4) the error came ' (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape' RE: convert a .py file to .exe file - snippsat - Nov-28-2019 (Nov-28-2019, 01:51 PM)vigneshboolog Wrote: 1) I added the drivers.sapi5 line to my codeYou shall not anything to code,only spec file. # talk.py import pyttsx3 engine = pyttsx3.init() engine.setProperty('rate',120) engine.say('hello how are you') engine.runAndWait() Quote:4) the error came ' (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape'In the build process? Are you using Python 3.7? RE: convert a .py file to .exe file - vigneshboolog - Nov-28-2019 python 3.8 |