I tried to compile a .py program for translating slang words, but after compiling into .exe, the executable file itself simply opened and immediately closed. Please see how you can solve this problem. Link to the program The program works when started from the interpreter.

import json import sys from PyQt5.QtWidgets import * from perevod import * from difflib import get_close_matches class MyWin(QtWidgets.QMainWindow): def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.btnResult.clicked.connect(self.getResult) def getResult(self): n1 = self.ui.txtNum1.toPlainText() output = retrive_definition(n1) if type(output) == list: for item in output: print("-item",item) out = item else: print("-output",output) out = output self.ui.lblSum.setPlainText(out) def mbox(self, body, title='Error'): dialog = QMessageBox(QMessageBox.Information, title, body) dialog.exec_() # ------------------------------------------------------------------- data = json.load(open("data.json")) def retrive_definition(word): word = word.lower() if word in data: return data[word] elif word.title() in data: return data[word.title()] elif word.upper() in data: return data[word.upper()] elif len(get_close_matches(word, data.keys())) > 0: action = input("Может быть Вы имели в виду %s ? [да или нет]: " % get_close_matches(word, data.keys())[0]) if action == "да": return data[get_close_matches(word, data.keys())[0]] elif action == "Да": return data[get_close_matches(word, data.keys())[0]] elif action == "Нет": return "Слово пока не существует в словаре." elif action == "нет": return "Слово пока не существует в словаре." else: return "Я не понимаю вашу запись. Извините." if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) myapp = MyWin() myapp.show() sys.exit(app.exec_()) 
 41 INFO: PyInstaller: 3.4 41 INFO: Python: 3.7.3 42 INFO: Platform: Windows-10-10.0.17134-SP0 43 INFO: wrote C:\Users\Xu33u\PycharmProjects\homework\translator.spec 44 INFO: UPX is not available. 45 INFO: Extending PYTHONPATH with paths ['C:\\Users\\Xu33u\\PycharmProjects\\homework', 'C:\\Users\\Xu33u\\PycharmProjects\\homework'] 45 INFO: checking Analysis 45 INFO: Building Analysis because Analysis-00.toc is non existent 45 INFO: Initializing module dependency graph... 46 INFO: Initializing module graph hooks... 48 INFO: Analyzing base_library.zip ... 2340 INFO: running Analysis Analysis-00.toc 2341 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by d:\python37\python.exe 2373 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of d:\python37\python.exe 2399 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of d:\python37\python.exe 2424 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\python.exe 2449 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\python.exe 2476 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\python.exe 2520 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of d:\python37\python37.dll 2545 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\python37.dll 2570 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of d:\python37\python37.dll 2594 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of d:\python37\python37.dll 2620 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\python37.dll 2645 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of d:\python37\python37.dll 2669 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of d:\python37\python37.dll 2694 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\python37.dll 2719 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of d:\python37\python37.dll 2744 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\python37.dll 2768 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of d:\python37\python37.dll 2794 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of d:\python37\python37.dll 2825 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of d:\python37\VCRUNTIME140.dll 2850 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\VCRUNTIME140.dll 2875 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\VCRUNTIME140.dll 2900 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\VCRUNTIME140.dll 2925 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\VCRUNTIME140.dll 2926 INFO: Caching module hooks... 2932 INFO: Analyzing C:\Users\Xu33u\PycharmProjects\homework\homework.py 2963 INFO: Loading module hooks... 2963 INFO: Loading module hook "hook-encodings.py"... 3026 INFO: Loading module hook "hook-pydoc.py"... 3026 INFO: Loading module hook "hook-xml.py"... 3206 INFO: Looking for ctypes DLLs 3207 INFO: Analyzing run-time hooks ... 3212 INFO: Looking for dynamic libraries 3247 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\_ssl.pyd 3272 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\DLLs\_ssl.pyd 3301 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\DLLs\pyexpat.pyd 3325 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of d:\python37\DLLs\pyexpat.pyd 3350 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\pyexpat.pyd 3374 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\DLLs\pyexpat.pyd 3398 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\DLLs\pyexpat.pyd 3427 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\DLLs\unicodedata.pyd 3451 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\unicodedata.pyd 3476 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\DLLs\unicodedata.pyd 3506 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\_hashlib.pyd 3534 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of d:\python37\DLLs\_bz2.pyd 3559 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\DLLs\_bz2.pyd 3583 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\_bz2.pyd 3608 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\DLLs\_bz2.pyd 3632 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\DLLs\_bz2.pyd 3661 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\_lzma.pyd 3685 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\DLLs\_lzma.pyd 3715 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\_socket.pyd 3746 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\select.pyd 3798 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3823 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3847 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3871 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3895 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3921 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3945 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3970 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 3994 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 4018 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of d:\python37\DLLs\libcrypto-1_1.dll 4050 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of d:\python37\DLLs\libssl-1_1.dll 4074 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of d:\python37\DLLs\libssl-1_1.dll 4100 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of d:\python37\DLLs\libssl-1_1.dll 4124 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of d:\python37\DLLs\libssl-1_1.dll 4124 INFO: Looking for eggs 4125 INFO: Using Python library d:\python37\python37.dll 4125 INFO: Found binding redirects: [] 4133 INFO: Warnings written to C:\Users\Xu33u\PycharmProjects\homework\build\translator\warn-translator.txt 4166 INFO: Graph cross-reference written to C:\Users\Xu33u\PycharmProjects\homework\build\translator\xref-translator.html 4177 INFO: checking PYZ 4177 INFO: Building PYZ because PYZ-00.toc is non existent 4177 INFO: Building PYZ (ZlibArchive) C:\Users\Xu33u\PycharmProjects\homework\build\translator\PYZ-00.pyz 4621 INFO: Building PYZ (ZlibArchive) C:\Users\Xu33u\PycharmProjects\homework\build\translator\PYZ-00.pyz completed successfully. 4628 INFO: checking PKG 4628 INFO: Building PKG because PKG-00.toc is non existent 4628 INFO: Building PKG (CArchive) PKG-00.pkg 5675 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 5677 INFO: Bootloader d:\python37\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe 5677 INFO: checking EXE 5677 INFO: Building EXE because EXE-00.toc is non existent 5678 INFO: Building EXE from EXE-00.toc 5678 INFO: Appending archive to EXE C:\Users\Xu33u\PycharmProjects\homework\dist\translator.exe 5749 INFO: Building EXE from EXE-00.toc completed successfully. 

Closed due to the fact that Sergey Gornostaev , Kromster , freim , aleksandr barakin , 0xdb are off-topic by participants on April 25 at 18:41

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Sergey Gornostaev, Kromster, freim, 0xdb
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Comments are not intended for extended discussion; conversation moved to chat . - Yuriy SPb 5:02 pm

1 answer 1

 Microsoft Windows [Version 6.3.9600] (c) Корпорация Майкрософт (Microsoft Corporation), 2013. Все права защищены. C:\Users\ALEX>cd C:\Users\ALEX\Downloads\homework C:\Users\ALEX\Downloads\homework>pyinstaller homework.py --onefile -- icon="C:\Us ers\ALEX\Downloads\homework\icon.ico" 160 INFO: PyInstaller: 3.4 160 INFO: Python: 3.7.0 161 INFO: Platform: Windows-8.1-6.3.9600-SP0 322 INFO: wrote C:\Users\ALEX\Downloads\homework\homework.spec 326 INFO: UPX is not available. 352 INFO: Extending PYTHONPATH with paths ['C:\\Users\\ALEX\\Downloads\\homework', 'C:\\Users\\ALEX\\Downloads\\homework'] 354 INFO: checking Analysis 354 INFO: Building Analysis because Analysis-00.toc is non existent 354 INFO: Initializing module dependency graph... 360 INFO: Initializing module graph hooks... 366 INFO: Analyzing base_library.zip ... 8461 INFO: running Analysis Analysis-00.toc 8507 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by c:\python37\python.exe 9134 INFO: Caching module hooks... 9151 INFO: Analyzing C:\Users\ALEX\Downloads\homework\homework.py 9376 INFO: Loading module hooks... 9377 INFO: Loading module hook "hook-encodings.py"... 9543 INFO: Loading module hook "hook-pydoc.py"... 9545 INFO: Loading module hook "hook-PyQt5.py"... 9842 INFO: Loading module hook "hook-PyQt5.QtCore.py"... 10059 INFO: Loading module hook "hook-PyQt5.QtGui.py"... 10617 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"... 11161 INFO: Loading module hook "hook-xml.py"... 11744 INFO: Looking for ctypes DLLs 11745 INFO: Analyzing run-time hooks ... 11753 INFO: Including run-time hook 'pyi_rth_qt5.py' 11766 INFO: Looking for dynamic libraries 12917 WARNING: lib not found: python35.dll dependency of c:\python37\lib\site- packages\sip.pyd 13918 INFO: Looking for eggs 13919 INFO: Using Python library c:\python37\python37.dll 13919 INFO: Found binding redirects:[] 13992 INFO: Warnings written to C:\Users\ALEX\Downloads\homework\build\homework\ warn-homework.txt 14102 INFO: Graph cross-reference written to C:\Users\ALEX\Downloads\homework\bu ild\homework\xref-homework.html 14296 INFO: checking PYZ 14296 INFO: Building PYZ because PYZ-00.toc is non existent 14298 INFO: Building PYZ (ZlibArchive) C:\Users\ALEX\Downloads\homework\build\ho mework\PYZ-00.pyz 16281 INFO: Building PYZ (ZlibArchive) C:\Users\ALEX\Downloads\homework\build\ho mework\PYZ-00.pyz completed successfully. 16307 INFO: checking PKG 16307 INFO: Building PKG because PKG-00.toc is non existent 16309 INFO: Building PKG (CArchive) PKG-00.pkg 16947 WARNING: One binary added with two internal names. 16947 WARNING: ('libGLESv2.dll', 'C:\\python37\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll', 'BINARY') 16949 WARNING: was placed previously at 16951 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll', 'C:\\python37\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll', 'BINARY') 31716 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 31786 INFO: Bootloader c:\python37\lib\site- packages\PyInstaller\bootloader\Wind ows-32bit\run.exe 31786 INFO: checking EXE 31786 INFO: Building EXE because EXE-00.toc is non existent 31786 INFO: Building EXE from EXE-00.toc 32248 INFO: SRCPATH [('C:\\Users\\ALEX\\Downloads\\homework\\icon.ico', None)] 32248 INFO: Updating icons from ['C:\\Users\\ALEX\\Downloads\\homework\\icon.ico '] to C:\Users\ALEX\AppData\Local\Temp\tmp2qxjxaqz 32288 INFO: Writing RT_GROUP_ICON 0 resource with 20 bytes 32288 INFO: Writing RT_ICON 1 resource with 67624 bytes 32448 INFO: Appending archive to EXE C:\Users\ALEX\Downloads\homework\dist\homework.exe 33388 INFO: Building EXE from EXE-00.toc completed successfully. C:\Users\ALEX\Downloads\homework> 

enter image description here

link to download the archive there 2 exe one with the console the other is not

  • Reinstalled, but still did not work. Here is a link to imgur with a Python folder - Vladislav
  • Install it like this C: / Python37 And download version 3.7.0 and re-install it through pip, install the modules, don't forget to remove the previous version - Alexander
  • When installing everything by default except the path - Alexander
  • I did as you said, it still poured varning + - as it did in past times and refused to work. Could you please dump the already compiled .exe file? Tomorrow, the defense of the project, I'm afraid that I myself will not have time to understand all this. - Vladislav
  • Well, only you give me data.json encoded utf-8 fill - Alexander