Error loading python27.dll error for pyinstaller

I successfully edited my spec file and added a folder with my data. It builds fine, but still cannot access the data. When I try to run the compiled .exe, I get this error: Error loading Python DLL: C:\Users\Sal\AppData\Local\Temp\_MEI60122\python27.dll (error code 126)

EDIT 1 - I still do not understand what my specification file is as follows:

 a = Analysis(['Clock_In.py'], pathex=['C:\\Users\\Sal\\Desktop'], hiddenimports=[], hookspath=None, runtime_hooks=None) a.datas += [('CO_time.pkl','CO_time.pkl', 'DATA')] a.datas += [('hours.pkl','hours.pkl', 'DATA')] a.datas += [('Obj_file.pkl','Obj_file.pkl', 'DATA')] a.datas += [('weekly_hours_dict.pkl','weekly_hours_dict.pkl', 'DATA')] pyz = PYZ(a.pure) exe = EXE(pyz, a.datas, a.binaries, a.scripts, exclude_binaries=True, name='Clock_In.exe', debug=False, strip=None, upx=True, console=True, icon="C:\Users\Sal\Desktop\Raindropmemory-Legendora-BrokenSword.ico") coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=None, upx=True, **name='Clock_In') 

EDIT 2

I use 32-bit python on a 64-bit OS (Windows 8), and I was informed that this could potentially cause problems, but still no solution.

EDIT 3

So, I just tried downloading a 64-bit python and putting it in my system path. pyinstaller is running with my .spec file and still got the same error code! What's going on here! An interesting detail is that the icon="C:\Users\Sal\Desktop\Raindropmemory-Legendora-BrokenSword.ico") from the specification file executed and successfully updated the icon, where, as before, this did not happen.

EDIT 4

This is the statement that I have in my code for MEIPASS directly from the documentation.

 if getattr(sys, 'frozen', False): # we are running in a |PyInstaller| bundle basedir = sys._MEIPASS else: # we are running in a normal Python environment basedir = os.path.dirname(__file__) 
+8
python packaging pyinstaller
source share
5 answers

You put this piece of code right at the top of the Python script, which you turn into an executable file, not a specification, and not your own script. I found an example here:

https://shanetully.com/2013/08/cross-platform-deployment-of-python-applications-with-pyinstaller/

+3
source share

I found the same error after creating a standalone executable as follows:

 pyi-makespec.exe -F program.py ## Customize script.spec just created 

and

 pyinstaller.exe -F script.spec 

so I needed to run the executable as an administrator to solve it.

I do not know the reason, because it was not my computer. At first I made this process first and worked like a charm, but not there. There may be some security configuration or a strange installation of python or wxpython , but I add this solution here because I searched for the clock without success, and it is a simple task that can save you some time before trying more complex approaches.

+9
source share

I ran into the same problem and finally found that the antivirus software treats โ€œpython27.dllโ€ as a trojan and removes it when exe tries to load.

The problem is solved by adding "... \ AppData \ Local \ Temp \" to the trusted zone.

0
source share

One simple thing to do is delete all the things in the following folder: C: \ Users \ xxx \ AppData \ Roaming \ pyinstaller. I fixed the problem after cleaning this folder. It is also possible to delete all files that Pyinstaller created last time.

0
source share

Having the same issue on python3.7 on Windows 10.

Fixed by adding the option --upx-exclude"vcruntime140.dll" .

More information can be found here.

0
source share

All Articles