I'm making a program using Python and using Pyinstaller to build the exe, but whenever I use it it crashes on launch.
I'm trying to make a program that changes the windows desktop background using Python 3.7.4.
This is the code I'm using:
def startvirus():
ctypes.windll.user32.SystemParametersInfoW(20, 0, "\aliengray.png", 0)
And this is the code I'm using to make the exe file using pyinstaller:
pyinstaller --onefile C:\Pythonfiles\compress\proto.pyw --add-data C:\Pythonfiles\compress\aliengray.png;:
I made it to change the background to aliengray.png, but it ends up just crashing on start.
It gives this error message:
:\aliengray.jpg could not be extracted!
fopen: Invalid argument
The problem must be with the location of the image .png
file. You specify a relative path, so when you run your EXE the image has to be in the same path relative to the folder of the EXE
If you want to test it, try to specify an absolute path and then create an executable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.