Cant run my .exe file after converting it from .py

So I am a complete beginner to Python programming. I worked through a tutorial to develop an application. I used pyinstaller to convert it to a .exe file but now when I try to run the exe file I get the following error.

"The ordinal 380 could not be located in the dynamic link library C:\Path\to\my\project"

It runs fine until I convert it to an exe so I don't understand what is wrong. Here is the command that I run

pyinstaller -F -w file_name.py

And here is the result that I get.

C:\Python\Bookmark Application>pyinstaller -F -w Bookmark.py 152 INFO: PyInstaller: 4.8 153 INFO: Python: 3.10.2 174 INFO: Platform: Windows-10-10.0.19042-SP0 175 INFO: wrote C:\Python\Bookmark Application\Bookmark.spec 181 INFO: UPX is not available. 190 INFO: Extending PYTHONPATH with paths ['C:\Python\Bookmark Application'] 498 INFO: checking Analysis 499 INFO: Building Analysis because Analysis-00.toc is non existent 499 INFO: Initializing module dependency graph... 502 INFO: Caching module graph hooks... 527 INFO: Analyzing base_library.zip ... 5495 INFO: Processing pre-find module path hook distutils from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-distutils.py'. 5496 INFO: distutils: retargeting to non-venv dir 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib' 7774 INFO: Caching module dependency graph... 7923 INFO: running Analysis Analysis-00.toc 7925 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by C:\Users\10341735\AppData\Local\Programs\Python\Python310\python.exe 7992 INFO: Analyzing C:\Python\Bookmark Application\Bookmark.py 8003 INFO: Processing module hooks... 8004 INFO: Loading module hook 'hook-difflib.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8006 INFO: Loading module hook 'hook-distutils.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8007 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8008 INFO: Loading module hook 'hook-encodings.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8124 INFO: Loading module hook 'hook-heapq.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8126 INFO: Loading module hook 'hook-lib2to3.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8168 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8170 INFO: Loading module hook 'hook-pickle.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8172 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8173 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8174 INFO: Loading module hook 'hook-xml.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8247 INFO: Loading module hook 'hook-_tkinter.py' from 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks'... 8418 INFO: checking Tree 8418 INFO: Building Tree because Tree-00.toc is non existent 8418 INFO: Building Tree Tree-00.toc 8495 INFO: checking Tree 8495 INFO: Building Tree because Tree-01.toc is non existent 8496 INFO: Building Tree Tree-01.toc 8598 INFO: checking Tree 8598 INFO: Building Tree because Tree-02.toc is non existent 8599 INFO: Building Tree Tree-02.toc 8620 INFO: Looking for ctypes DLLs 8635 INFO: Analyzing run-time hooks ... 8638 INFO: Including run-time hook 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_subprocess.py' 8645 INFO: Including run-time hook 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_inspect.py' 8652 INFO: Including run-time hook 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py' 8661 INFO: Including run-time hook 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_multiprocessing.py' 8669 INFO: Including run-time hook 'C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth__tkinter.py' 8679 INFO: Looking for dynamic libraries 8997 INFO: Looking for eggs 8997 INFO: Using Python library C:\Users\10341735\AppData\Local\Programs\Python\Python310\python310.dll 8998 INFO: Found binding redirects: [] 9000 INFO: Warnings written to C:\Python\Bookmark Application\build\Bookmark\warn-Bookmark.txt 9045 INFO: Graph cross-reference written to C:\Python\Bookmark Application\build\Bookmark\xref-Bookmark.html 9093 INFO: checking PYZ 9093 INFO: Building PYZ because PYZ-00.toc is non existent 9094 INFO: Building PYZ (ZlibArchive) C:\Python\Bookmark Application\build\Bookmark\PYZ-00.pyz 9463 INFO: Building PYZ (ZlibArchive) C:\Python\Bookmark Application\build\Bookmark\PYZ-00.pyz completed successfully. 9482 INFO: checking PKG 9482 INFO: Building PKG because PKG-00.toc is non existent 9483 INFO: Building PKG (CArchive) Bookmark.pkg 16279 INFO: Building PKG (CArchive) Bookmark.pkg completed successfully. 16302 INFO: Bootloader C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe 16302 INFO: checking EXE 16303 INFO: Building EXE because EXE-00.toc is non existent 16303 INFO: Building EXE from EXE-00.toc 16303 INFO: Copying bootloader EXE to C:\Python\Bookmark Application\dist\Bookmark.exe 16311 INFO: Copying icon to EXE 16311 INFO: Copying icons from ['C:\Users\10341735\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\bootloader\images\icon-windowed.ico'] 16320 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes 16320 INFO: Writing RT_ICON 1 resource with 3752 bytes 16320 INFO: Writing RT_ICON 2 resource with 2216 bytes 16321 INFO: Writing RT_ICON 3 resource with 1384 bytes 16321 INFO: Writing RT_ICON 4 resource with 38188 bytes 16321 INFO: Writing RT_ICON 5 resource with 9640 bytes 16321 INFO: Writing RT_ICON 6 resource with 4264 bytes 16321 INFO: Writing RT_ICON 7 resource with 1128 bytes 16324 INFO: Copying 0 resources to EXE 16324 INFO: Emedding manifest in EXE 16325 INFO: Updating manifest in C:\Python\Bookmark Application\dist\Bookmark.exe 16381 INFO: Updating resource type 24 name 1 language 0 16384 INFO: Appending PKG archive to EXE 18893 INFO: Building EXE from EXE-00.toc completed successfully.

Can anybody help me with this please?


Solution 1:

What you are asking is: How do I convert python to a single exe file? You are on the correct path using pyinstaller but you need to specify that you want to compile it to 1 single file with the argument --onefile

The command should look like this: pyinstaller --onefile file_name.py

Check out the Pyinstaller Manual: https://pyinstaller.readthedocs.io/en/stable/

Solution 2:

you are using the command wrong.

the command for pyinstaller - pyinstaller --onefile pythonScriptName.py

more documentation - [https://pyinstaller.readthedocs.io/en/stable/] 1

examples - https://datatofish.com/executable-pyinstaller/