I am using pyinstaller to generate an executable code for my python.py file. However, I am getting this error:
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\utils\win32\icon.py", line 143, in CopyIcons_FromIco
hdst = win32api.BeginUpdateResource(dstpath, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32ctypes\pywin32\win32api.py", line 208, in BeginUpdateResource
with _pywin32error():
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
**win32ctypes.pywin32.pywintypes.error: (225, 'BeginUpdateResourceW', 'Operation did not complete successfully because the file contains a virus or potentially unwanted software.')**
My antivirus is allegating there is a virus when running pyinstaller: Trojan:Win64/Malgent!MSR
I tried to uninstall python, reinstall, and nothing
I had a similar issue today when using the latest pyinstaller (6.X.X) on Windows 11. For me, changing to an older release (5.13.2) fixed the issue.
To install 5.13.2 you can use pip module with following:
pip install pyinstaller==5.13.2
Try not using -w in pyinstaller. Previously, I used…
pyinstaller --onefile -w image.py
…and got the same problem. But when I do…
pyinstaller --onefile image.py
…it is good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With