Making an Executable from a Pygame Game (PyInstaller)

  Рет қаралды 108,352

DaFluffyPotato

DaFluffyPotato

Күн бұрын

Пікірлер
@DaFluffyPotato
@DaFluffyPotato 5 жыл бұрын
A couple important notes in case things aren't working: If you use pygame.font.SysFont(None, x), the executable won't work. You can switch out None for 'calibri' or whatever and it'll work. A note for Linux users: I think that pyinstaller sometimes installs as "PyInstaller" with it being case sensitive. If you've got any issues (normally it'll say something like "failed to execute script" or it'll not do anything), take out the --onefile and --noconsole. Then run the executable from the command line to see the error.
@laksanaijampakaew2370
@laksanaijampakaew2370 4 жыл бұрын
Thanks so much about font
@FeverDev64
@FeverDev64 4 жыл бұрын
Im having issues. The window and console opens and closes after a few seconds
@gdsupermoonsuperpresents8404
@gdsupermoonsuperpresents8404 4 жыл бұрын
It not helped ;-;
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
@@gdsupermoonsuperpresents8404 did you follow the last step?
@gdsupermoonsuperpresents8404
@gdsupermoonsuperpresents8404 4 жыл бұрын
@@DaFluffyPotato Ill just making pong, And it have 3 files: ball.py, paddle.py, and main.py, and music
@nyct.o
@nyct.o 5 жыл бұрын
Just wanted to say thanks for your tutorials, they help so much and they're clear and well made
@seekergx8096
@seekergx8096 4 жыл бұрын
Thank you so much for pointing out the problems that might arise every step of the way, saved me so much time just in 6 minutes! Great detail man! +subscribed
@henrypdt
@henrypdt 4 жыл бұрын
To anyone having the failed execute script one, or pygame.error : Failed loading libmpg123.dll: the specified module could not be found, try changing your pygame.mixer.music.load audio file to .wav instead. It works for me
@stijndcl
@stijndcl 3 жыл бұрын
@@suvradippaul7843 he literally wrote the solution in the comment
@lightpearl1495
@lightpearl1495 3 жыл бұрын
I wish I could've seen this comment before struggling for a week :/
@marcsalvado
@marcsalvado 2 жыл бұрын
This is the comment I've been looking for
@JastaCon
@JastaCon Жыл бұрын
i have the same problem but my audio-data was wav. from the beginning. so this sadly is no solution to me
@anonyme894
@anonyme894 Жыл бұрын
THANKS A LOT!! Advice : for me I had to change the font from none to 'arial' (whatever non-default font is ok), and add --exclude-module pydoc in pyinstaller line, and it finally worked!! Love, my students will enjoy 😍
@daboxguy3848
@daboxguy3848 3 жыл бұрын
I feel like I can't escape your tutorials. This is going to be very useful. Thanks 👍
@BattleandForge
@BattleandForge 3 жыл бұрын
Made an executable from my first game thanks to this tutorial!
@vitoroliveira8381
@vitoroliveira8381 3 жыл бұрын
I'm getting this Traceback (most recent call last): File "client.py", line 1, in import pygame ModuleNotFoundError: No module named 'pygame' [69877] Failed to execute script 'client' due to unhandled exception!
@vamakshi811
@vamakshi811 4 жыл бұрын
Thanks for giving solution for every small problem , subscription is asure from my side
@rickysacco2720
@rickysacco2720 4 жыл бұрын
Hi… thank for tutorial… I've a question, is possible to converti pygame script with images to an exe that doesn't need image files to work..?
@anamariabalaban
@anamariabalaban 2 жыл бұрын
Thanks for the tutorial it helped me a lot. I will look for other tutorials of yours and especially on pygame if you created them. 🤗
@wojtex4119
@wojtex4119 3 жыл бұрын
Thank you! Now I can share my games with friends, who don't have python installed.
@emilis173
@emilis173 2 жыл бұрын
thanks, this and some of your other tutorials, super usefull.
@Ravo_Games
@Ravo_Games Ай бұрын
if your getting the error "Pyinstaller is not recognized" use "python -m PyInstaller" instead of PyInstaller, and if you are using an external drive it may not work so use the drive pip installed to
@pratamatanar
@pratamatanar 3 жыл бұрын
thank you so much finally the problem that was making me dizzy was finally solved
@medveed_
@medveed_ Жыл бұрын
Nuitka: 💀 1 translates code to c 2 nearly impossible to decompile 3 performance boost 4 more compatibility
@bovfbovf
@bovfbovf 4 жыл бұрын
Hey, I love your tutorials, but everytime I try and package a python script in .exe windows defender recognizes it as a virus, do you know any workarounds?
@deveagle3608
@deveagle3608 3 жыл бұрын
I don't know any, other than getting a digital license, but just tell the user to ignore it.
@djlazer1
@djlazer1 3 жыл бұрын
The only way is to get a digital signature which costs money. It kinda sucks but at least they can still run it.
@Noober666
@Noober666 7 ай бұрын
Turn of windows defender and then turn it back on when ur done
@Necr0h
@Necr0h Жыл бұрын
Thanks for you tuto. But i see to you need to add your Data (with assets, sound, music) with the .Exe to play. Is it possible to compile your code in and executable which includes the assets ? I mean i want to have only one file that secretely contains the assets. To don't let them collectable and modifiable by other users ? Thanks :)
@ОбидинНиколай
@ОбидинНиколай 3 ай бұрын
Hello guys. Please help me, I cannot work in vscode, I have errors with import and when opening pyinstaller, I do not have errors that modules and file are not found main.exe it opens without errors. For example, I have this structure: src/ scripts/ core/ config/ settings.py utils/ debug.py main.py world/ logic.py assets/ And for example my file main.py doesn't know what the import is: from core.config.settings import WINDOW_WIDTH, WINDOW_HEIGHT, FRAME_RATE from world.logic import Level I want to import everything like this src/scripts/ and then what do I need, which file, etc. For example, with the current structure, I have a file main.py (executable file) open the game only after I make the file main.exe and for example, in Visual Studio, Code gives an error about import. What to do, please help.
@genericyoutubechanneluwu
@genericyoutubechanneluwu 9 ай бұрын
"alot of people make the mistake of going into build, and looking for the executable," as I'm literally doing that exact thing.
@nikhilhaspe2734
@nikhilhaspe2734 2 жыл бұрын
thanks dude! i was struggling to convert my game into exe cause i wasn't including assets folder to final exe directory thanks
@nerdyturkey312
@nerdyturkey312 4 жыл бұрын
Cool! Super helpful for my new pygame channel. But my .exe's are kinda massive (200MB) even though only module explicitly imported is pygame 2, and my assets folder is
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
I think it’s including a bunch of unnecessary libraries. If you don’t package as one file, they’re easy to just go and delete. If you want onefile, you’ll need to check the documentation. I don’t have an issue here.
@letsgetcopyright2603
@letsgetcopyright2603 3 жыл бұрын
Best lecture in ever..
@JaguarWisdom-9
@JaguarWisdom-9 Жыл бұрын
Thanks, works a treat. Now I can share some mini games. :)
@alexandertownsend5079
@alexandertownsend5079 5 ай бұрын
When I try what you did I just an error message telling me that pyinstaller is not a valid internal command. Is it Pyinstaller with a lowercase i or pyInstaller with an uppercase i? Also does pyinstaller have to be in the same folder as my pygame game?
@dhrumildave4221
@dhrumildave4221 2 жыл бұрын
Thx for this, this is so good
@dylanjayabahu2878
@dylanjayabahu2878 4 жыл бұрын
Is there a way to package all of the images (dependencies) of my program into one so that I don't need to have the file in the same directory as the other images?
@vrajsavani
@vrajsavani 2 жыл бұрын
very usefull! Thank you for this tutorial. 👍
@AnoojShete
@AnoojShete 4 жыл бұрын
Hello.. I have a question.. How to shoot bullets in all the direction 360° in mouse pointer like in your aeroblaster game??
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Watch my video on trig
@AnoojShete
@AnoojShete 4 жыл бұрын
@@DaFluffyPotato okay 👍👍
@naomi2801
@naomi2801 2 жыл бұрын
Hello DaFluffyPotato, thanks for your tutorial. It worked, my issue is that some antivirisus dont like the exe, how did you work around the problem?
@DaFluffyPotato
@DaFluffyPotato 2 жыл бұрын
There are several (not so simple) solutions online. Although if you release a game onto something like Steam where it’s started through a launcher, it’s a non-issue.
@naomi2801
@naomi2801 2 жыл бұрын
​@@DaFluffyPotato I tried several, but until now I had no succes. I found a page on stackoverflow the answer was encrypting the code, but that lead to more issues. The other solution was using pyinstaller without --onefile but that is not really what I want. So if you have a solution on hand, I would be grateful.
@thomascasasnovas4372
@thomascasasnovas4372 4 жыл бұрын
Thanks a lot for this tutorial ! It works fine (:
@ZgavY
@ZgavY 2 жыл бұрын
Okay,but is there a way to make it into an android package instead? Can I port my games to mobile?
@mlphyzix
@mlphyzix 2 жыл бұрын
Thank you this was very helpful!
@keemixvico975
@keemixvico975 Жыл бұрын
it didn't work as expected... : Traceback (most recent call last): File "menu.py", line 1, in import pygame ModuleNotFoundError: No module named 'pygame'
@matjeijs3289
@matjeijs3289 3 жыл бұрын
where do i find the data folder on 5:36?
@UltronZX
@UltronZX Жыл бұрын
this looks helpful but why aren't u running it in python console (and is it possible to do all this in console)?
@jarkk0896
@jarkk0896 3 жыл бұрын
when i launch the .exe it says: Unhandled exception in script Failed to execute script 'gamename' due to unhandled exception: expected str, bytes or os.PathLike object, not BytesIO Failed to obtain/convert traceback!
@technoterminator1368
@technoterminator1368 2 жыл бұрын
I am having problem is that after writing pyinstaller script name. py then it shows 'tuple index out of range' can you tell how to fix this?
@omkakatkar9003
@omkakatkar9003 4 жыл бұрын
Is there a way to create a package of compiled code with all dependencies which needs to be installed once?
@plexus2000
@plexus2000 2 жыл бұрын
It does not work for me when i put in the file that its in it just says cant find path
@StormwreckerOfficial
@StormwreckerOfficial Жыл бұрын
Hey, man! Thanks for the video! I know you have created multiple games on the market, and I was wondering how you compile all of the different game dependencies (images, sounds, other folders, other python files, etc.) into one file, or at least a folder without hackable files that can be tampered with. I will need help with this in the future, so if you had any thoughts on this, that would be great. Thanks!
@ibritics
@ibritics 3 жыл бұрын
Do you have a tutorial of the game that you have developed? It looks so cool!!
@normalpepsi7993
@normalpepsi7993 2 жыл бұрын
I have a question, in the code of my game i save the high scores on to a file, but when i make the game an exe it stops saving the high scores do u know how to fix this?
@jimmypretzel4785
@jimmypretzel4785 4 жыл бұрын
legend thanks for the detailed tutorial!
@xoxogamewolf7585
@xoxogamewolf7585 Жыл бұрын
But wait, if you wanted to use pygame with it, but pygame isn't installed on another computer using the game, then wouldn't it just crash?
@xoxogamewolf7585
@xoxogamewolf7585 Жыл бұрын
nvm i just tested it with wsl and it worked fine
@Dugiedugdug
@Dugiedugdug 4 жыл бұрын
Getting a weird error "(1920, 'LoadLibraryExW', 'The file cannot be accessed by the system.')" Firstly I couldnt install python as usual on windows it took me to microsoft store to download it but I found the packages folder in there with pyinstaller.exe. Running it with the path gives the same output as you running "pyinstaller" in CMD so I believe it was opening it correctly. But then it starts to package the .py file and gives this error (among many other outputs)
@saturnine.
@saturnine. 4 жыл бұрын
I'm having an issue where, on running the exe, I get an error that says my engine file couldn't find a file it needs. I have a nearly identical set up with a folder called data with all of assets and engine file in it and it works just fine run in an IDE, but even when the data folder is in the same directory as the exe that pyinstaller creates, I get this error. Any insight would be appreciated
@KeiGGR
@KeiGGR 4 жыл бұрын
I'm having a hard time trying to run de .exe. It wasn't working so I ran it throught CMD to see what the error was and I'm getting "pygame Module not found".. I know I can solve this by providing the module path to the interpreter but that would fix it for me, what if anyone else without Python or Pygame wants to use it? Anyone know any more optimal solution? EDIT: nvn fixed it by installing pygame throught CMD (before I installed it throught Pycharm terminal as usual), now is working fine.
@jojomark4946
@jojomark4946 3 жыл бұрын
I have all the dependencies but when I open the .exe file it closes immediately. help? edit: the problem is C:\Users\MYUSER\PycharmProjects\well\dist>TicTacToe.exe Traceback (most recent call last): File "TicTacToe.py", line 1, in ModuleNotFoundError: No module named 'pygame' [7908] Failed to execute script TicTacToe I have pygame, so I don't get the problem...
@JS-fg1kj
@JS-fg1kj 4 жыл бұрын
thank you for your kind explanation but I have one problem when I use "pygame.font.SysFont" in my script, my exe file execute and close directly when I don't use "pygame.font.SysFont" in my script, my exe file execute sucessfully what should I do if I want to use "pygame.font.SysFont" in my script? p.s. : both cases are executed successfully when using py file
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
"If you use pygame.font.SysFont(None, x), the executable won't work. You can switch out None for 'calibri' or whatever and it'll work." So just pygame.font.SysFont('calibri',10) or something. I'm not sure what font Pygame uses as None, so you may have to go through a few system fonts.
@JS-fg1kj
@JS-fg1kj 4 жыл бұрын
@@dafluffypotatovr7362 omg thxxxx it works perfectly
@kaan_tuna
@kaan_tuna Жыл бұрын
For me it says it doesn't recognize pyinstaller as a command
@paradoxwjs5578
@paradoxwjs5578 2 жыл бұрын
what needs to be done to export to mobile?
@bryankim5595
@bryankim5595 4 жыл бұрын
only shows 'C:\Users\teamb\Desktop\PythonWorkspace\pygame_project' is not recognized as an internal or external command, operable program or batch file. when trying to put in directory
@kelsierii4747
@kelsierii4747 2 жыл бұрын
you have to type cd before that part
@jinwhogames
@jinwhogames 4 жыл бұрын
oh my god thank you so much it help a lot!
@zagaky
@zagaky 4 жыл бұрын
Thanks a lot! But how i change the icon of the executable plz
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
Take a look at this: pyinstaller.readthedocs.io/en/stable/usage.html (--icon)
@Noober666
@Noober666 7 ай бұрын
exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='YourGame', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=True, icon='icon.ico')
@beebit_
@beebit_ 4 жыл бұрын
Hi, nice video! I did what you told me and indeed, it creates an exe file. However, there is an error when I try to open the exe file eventhough my game works when I launch it from Thonny, spyder,etc. Note1 : my images aren't in a separate folder, everything is on the same folder. (Note2 : my python files (.py) are notes by default)
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
You can see the details of the error if you follow the instructions in the pinned comment.
@marcus.the.younger
@marcus.the.younger 4 жыл бұрын
help... newbie programmer here... when i opened the exe file... a command prompt opens up and closes instantly... thanks you for your response in advance
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Follow the instructions in the pinned comment
@marcus.the.younger
@marcus.the.younger 4 жыл бұрын
@@DaFluffyPotato will do tnx
@eboatwright_
@eboatwright_ 3 жыл бұрын
HELP Edit: I FIXED IT! I just renamed the .exec file to .app, and it works! :D This doesn't work on Mac. It makes the .app file, and a .exec file. The app file doesn't run even with the data folder, but the .exec file does run, but it opens the terminal with it. I have no idea what to do.
@callmeserpent
@callmeserpent 3 жыл бұрын
i have the pyinstaller: error: the following arguments are required: scriptname
@eboatwright_
@eboatwright_ 3 жыл бұрын
@@callmeserpent you have to type in pyinstaller then whatever configurations you want.
@discotrain173
@discotrain173 2 жыл бұрын
So if I have windows and I want my friend who has a mac to play my game, do I have to package using pyinstaller on a mac to make the executable? Or is there a way I can package my game on my windows operating system for it to work on macs?
@DaFluffyPotato
@DaFluffyPotato 2 жыл бұрын
You have to package it on a mac. I end up not ever porting my games to mac because I don’t have one.
@discotrain173
@discotrain173 2 жыл бұрын
@@DaFluffyPotato interesting thank you. So when you upload your game on Steam, are you able to send in just your executable with assets/dependencies in a zip folder? Or do you need to do extra steps on your end such as more packaging or coding?
@renudixit3087
@renudixit3087 4 жыл бұрын
Do i need to add dependencies like os module, pygame module, etc In the same folder , Because i is saying failed to start script
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Read the pinned comment first since the issue likely isn't what you think. Sometimes PyInstaller has issues with some dependencies, but I've personally never had the issue before and I don't think that's how you deal with it. If it fails to get dependencies, I think there's a way to manually list them for PyInstaller to fetch.
@mahedul
@mahedul 4 жыл бұрын
@@DaFluffyPotato The pinned comment is no longer there and I am still facing the same issue please help
@jarnedemoen7527
@jarnedemoen7527 3 жыл бұрын
Hi! I recently made a simple game and I succesfully converted it to an exe file and my friends can also play it but the only problem is that the movement of my game is a lot slower when I opened the exe file on a friends computer. It's a spaceinvader game and my enemies and spaceship move a lot slower than i had programmed. Do you know what to do about it? Thx in advance :)
@djlazer1
@djlazer1 3 жыл бұрын
Did you add a set FPS, you didn't provide enough information.
@riukywastaken
@riukywastaken Жыл бұрын
I know it's a bit late, but that seem to be a problem in your code, to avoid that you need to have a setted FPS using the clock function of pygame
@notdouglas1966
@notdouglas1966 3 жыл бұрын
How do you get around the problem of every anti virus ever thinking the .exe file is a virus or trojan?
@djlazer1
@djlazer1 3 жыл бұрын
You need a software license, which can be expensive. There's no other workarounds.
@notdouglas1966
@notdouglas1966 3 жыл бұрын
@@djlazer1 ok thx better sell some games ig :/
@sabyasachichoudhury2920
@sabyasachichoudhury2920 3 жыл бұрын
I'm leaving this comment behind to help anyone who has some of the common errors while converting pygame to exe. When converting, the first time do the conversion with the following stuff: pyinstaller whatever_the_man_file_name_is.py --onefile --debug bootloader. After that, run the exe file directly from the command line and not by opening the file. To run it from CMD, just type open CMD in the directory and type in whatever_file_name.exe This way, you'll be able to easily see what errors are being generated and then amend them. Some common errors: - no module named pygame. To solve this, just type in pip install pygame. Remember, it has to be installed on your computer as well, not just your IDE. - FileNotFoundError: Some dependency is clearly in the correct dictionary, but still returns an error. Remove the part from the code which needs the file, create the new exe and run it. Then delete that, add back the parts, and create exe. Should work. Also advise restarting. - Sysfont error. It expects some string or bytes, not _bitIO (Or something like that) wrapping. That's some intrinsic problem with pygame and pyinstaller. Only way around is use solely Arial or Sans. Sometimes, both work, sometimes only one. Depends on your computer.
@tropicomango
@tropicomango 4 жыл бұрын
help! cannot import name 'opengl_arrays_modules' from 'PyInstaller.utils.hooks' (c:\users\charl\anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py)
@darkvenomz3927
@darkvenomz3927 2 жыл бұрын
It works only when i dont make it noconsole . Can someone help i ca't make it with --noconsole ( i am on Mac)
@theonlydhruv7888
@theonlydhruv7888 2 жыл бұрын
when I try to to do this(I'm on Mac btw) it works... but when I try to open it, the pygame window opens and closes after a second. This also happens when I put in all the data
@myszot6804
@myszot6804 3 жыл бұрын
Thanks for good tutorial!, but allways when i'm trying to open the file, windows defender is popping up and deletes it...
@anastrong8306
@anastrong8306 2 жыл бұрын
Hello! I don't know if you'll answer or even see this comment but i ran into a problem when trying to turn my pygame code into an executable. I followed your steps on installing pyinstaller and moving the data folder to where the executable is. When i try to run it, i get an error saying "no module named pygame". Im positive i have pygame installed because it works fine when i run the code itself. Am i missing something here?
@hey9530
@hey9530 2 жыл бұрын
dude ur a lifesaver
@pihliss
@pihliss Жыл бұрын
I'm new to PyGame. How can I create this "engine.py" file.
@XenolVlatriX
@XenolVlatriX 3 жыл бұрын
I followed all the steps but I still have the error popup. I cant hear background music from my game but no images..
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Read the pinned comment
@nathnaeldereje5127
@nathnaeldereje5127 Жыл бұрын
Thanks, a lot brother. I've been going through a lot because I couldn't add the assets into the game and my game keeps cruching. Even tried the --add-date but didn't work. Your video though is amaizing.
@Dorbellprod
@Dorbellprod 3 жыл бұрын
Indeed, as some have mentioned, "failed to obtain/convert traceback" has become quite a nuisance, and the closest thing to a playable game in the .EXE format.
@MRJakeyBro
@MRJakeyBro 6 ай бұрын
'Pyinstaller' is not recognized as an internal or external command, operable program or batch file.
@Lucas264
@Lucas264 4 жыл бұрын
Thank you so much!! It works 100% fine except I get the error at 3:59 when I try to put everything in a "data" folder right next to the .exe
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
It doesn’t have to be a data folder. You basically just replace your main script with the packaged one.
@Lucas264
@Lucas264 4 жыл бұрын
Hmm... so far every time I put the assets into a different folder as the .exe file (like you did) they were off limits to the program. The packaged script is the .exe, right? Or am I missing something...
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
The packaged script is the exe. Try dropping it in the same folder you work in (along with the script you packaged). Although if you happen to be on Mac OS, then it may not work due to working directory issues.
@anto-s8x
@anto-s8x 3 жыл бұрын
@@Lucas264 When you move the assets to a separate folder you need to specify the directory in the python script. Before you didn't need to do this as they were on the same folder as the python file, but now they are in another directory. Example (Windows): pygame.image.load("data\whatever.png") Example (Linux and Mac): pygame.image.load("data/whatever.png")
@satwikkar7761
@satwikkar7761 4 жыл бұрын
thnx bro...i really needed this.,.
@adithyadshenoi2668
@adithyadshenoi2668 4 жыл бұрын
Mine does not open , just puts up a blank screen and goes
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Did you read the pinned comment? It may help you with your issues.
@Mikendlela27
@Mikendlela27 2 жыл бұрын
Hi. I'm a huge fan of your work. I don't know if you've considered this, but can you make a phone apk executable from python code? I've been working on my big game and I wanted to make it playable for phone.
@aking9077
@aking9077 4 жыл бұрын
My exe pygame window opens then closes soon after.... No errors when I run it in CMD... If there is an error (from when I used cx Freeze) it says it cant open the images
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
You’re probably not putting the executable in the right directory
@Samuvt2
@Samuvt2 4 жыл бұрын
Does not work, when I open the .exe file it just dont do anything, any fix?
@grishakek
@grishakek 4 жыл бұрын
I have an issue, it works perfectly but when I want to make the exe file it shows me an error and says "missing module numpy or something..." in my game, I just use pygame and random module, nothing more...
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Seems odd. One way you could attempt to fix it is to install numpy and import it in your game. It's also possible that you used a function from Pygame that needs numpy (I don't know if any of the functions use it.)
@grishakek
@grishakek 4 жыл бұрын
@@DaFluffyPotato thank you for the response, I realized that PyInstaller doesn't support Python 3.8... I installed python 3.7.6 and now it's working. :D
@rinderizard7494
@rinderizard7494 4 жыл бұрын
Pygame uses numpy in its backend
@lXBlackWolfXl
@lXBlackWolfXl 4 жыл бұрын
I was able to make an executable and it runs fine, but when I exit the game I get an error message pop-up that says "failed to execute script pysnake". My game is a snake clone, obviously. Everything in the game works fine; this pop-up only appears when I trigger my closeGame() function, which happens if I press esc or if I choose to not start another game.
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
Follow the instructions in the pinned comment. This normally happens when the game encounters an error.
@lXBlackWolfXl
@lXBlackWolfXl 4 жыл бұрын
@@dafluffypotatovr7362 The command prompt told me that 'quit' was not defined. My function for closing the game looks like this: def closeGame(): bleep.play() pygame.time.delay(300) pygame.quit() quit() That final command must be what's causing the problem. I have no idea why.
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
​@@lXBlackWolfXl I use sys.exit() (sys needs to be imported though).
@lXBlackWolfXl
@lXBlackWolfXl 4 жыл бұрын
@@dafluffypotatovr7362 That fixed the issue, thank you.
@rochakadhikari9264
@rochakadhikari9264 4 жыл бұрын
I followed the exact process, but when i try to run the .exe file, it says failed to execute script, i even changed the font in Sysfont to none, but still error popped up
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
You don’t change it to none, you take it out. Also, you can see the error if you follow the instructions in the pinned comment.
@frog-animation
@frog-animation 3 жыл бұрын
Thank you
@simplepycodes
@simplepycodes 4 жыл бұрын
Is it possible to make a video on how to upload a game made by pygame?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
You just zip it up and upload it wherever. For Itch.io, it’s super simple and self explanatory. For Steam, it’s more complicated, but I legally can’t because I signed an NDA.
@mahimapandey3082
@mahimapandey3082 2 жыл бұрын
how can i share the exe file. i created a zip of the folder like u have shown in video but idk how to share that zip file with my friends. i cant send on gmail since it doesnt allow sending of exe files even if they are contained inside zip file . i also tried sending by google drive link but whenever my friends try to download the zip it says the file has virus cannot download. plz help 😭😭😭😭😭😭😭😭😭
@CuriousityGaming
@CuriousityGaming 2 жыл бұрын
Tell your friends to disable the antivirus OR you can also go to settings and make some changes and take permission from the antivirus to run the exe file.
@mdmasudurrahman8074
@mdmasudurrahman8074 4 жыл бұрын
I follow of this steps and able to generate .exe file but after double click the exe it just shoe "Widows has stopped working" please let me know what can I do to resolve this issue.
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
That likely means that your game was stuck in an infinite loop or you weren’t taking input. If you believe there may be an error, follow the instructions in the pinned comment.
@penguinmaster6510
@penguinmaster6510 3 жыл бұрын
Can you like do it on a mac?
@vaibhavkrkm
@vaibhavkrkm 4 жыл бұрын
Nice, by the way, we can convert multiple files package to a setup also by using application like Install Creator!! That's really nice.. Anyways, where did u get Data folder from
@stijndcl
@stijndcl 3 жыл бұрын
...he made it...? He literally said in the beginning it contains some of the scripts & assets he uses...
@kelsierii4747
@kelsierii4747 2 жыл бұрын
Hey Im getting an issue where I run the .exe and the console shows up, waits a few seconds, outputs something and immediately closes. I tried running it on cmd and it gives no error. From what I could read the error that shows on the console is about __init__.py and lower down it has something along the lines of "Import error: failed loading dll file: incorrect parameter". I used no flags. edit: ended up using py2exe instead, worked fine and I found no solution at all to my problem with pyinstaller
@DaFluffyPotato
@DaFluffyPotato 2 жыл бұрын
you're gonna have to go down the google rabbit hole for that one. I haven't seen that before (unless it's some sort of audio-related pygame dll, in which case I completely forgot what I had to do).
@kelsierii4747
@kelsierii4747 2 жыл бұрын
@@DaFluffyPotato ah damn, thanks anyway, maybe something with importing a function from other script. Ill update my comment if I find a solution
@hw2007
@hw2007 3 жыл бұрын
So..... Windows virus and threat protection keeps auto-deleting the EXE file, because it thinks that it is a virus. Is there any way to stop this?
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Usually it doesn’t happen if you don’t use -onefile. There are other more tedious methods as well.
@broor
@broor 3 жыл бұрын
@@DaFluffyPotato it still happens! (btw i love this video it is sublime!)
@valentinvalenciavalencia7299
@valentinvalenciavalencia7299 3 жыл бұрын
Thank you very much
@ishankamboj3522
@ishankamboj3522 4 жыл бұрын
My .exe file shows an error that it had stopped working. Pls help
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Does the screen turn white? This can happen when you aren’t taking user input or the game is in an infinite loop. Also, I’d recommend reading the pinned comment and following the instructions there to check for errors.
@ishankamboj3522
@ishankamboj3522 4 жыл бұрын
Thank you sir
@succerzxix1950
@succerzxix1950 4 жыл бұрын
Does the shell not open up when you run the program?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
The -noconsole line removes it
@reanimateddude432
@reanimateddude432 4 жыл бұрын
help! when I tried with only --onefile the exe file appears but when I add --noconsole the exe file won't appears
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
So you're saying that there's no error when you package it, but there's also no executable file in dist?
@reanimateddude432
@reanimateddude432 4 жыл бұрын
@@DaFluffyPotato thanks for your reply but I sorted out the problem, it was my anti virus that was deleting the runw.exe file assuming it as trojan. So, I allowed it and it made exe file.
@advaitshrivastava6119
@advaitshrivastava6119 4 жыл бұрын
My .exe file is not running. When I click, it just shows a blank black window for a few second and then it terminates. Please help me.
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Follow the instructions in the pinned comment
@advaitshrivastava6119
@advaitshrivastava6119 4 жыл бұрын
@@DaFluffyPotato Okay so when I changed the SysFont to Font it is working, thank you so much. But when I close the .exe after the execution of the program I get an error window, failed to execute the script. How to overcome that?
@risabhkedia2685
@risabhkedia2685 4 жыл бұрын
I have my game in different python files linked together in a folder. All the images are in the same folder. I copied the exe to that folder and tried to run it but only a black screen appears and dissapears. What do I do??
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
If a black screen appears and disappears without an error (assuming it's not the command line), it's usually because your script reached the end for some reason. Take a look at the pinned comment if you're having issues.
@risabhkedia2685
@risabhkedia2685 4 жыл бұрын
I tried removing --noconsole and --onefile and ran the executable. The cmd behind showed the typical--"hello welcome to pygame and all that stuff ..."" And then the main screen(still black) appeared and dissapeared without any error. What do I do now??
@risabhkedia2685
@risabhkedia2685 4 жыл бұрын
While I was searching for it I found about environment variables. Should pyinstaller be somehow included in path or something.?
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
@@risabhkedia2685 It doesn't have to be. It would just change the command you use to package the game. That wouldn't have anything to do with your issue. Like I said the first time though. If it closes like that, check and make sure that it's not running through the whole script. (put a print statement at the beginning and the end then repackage) I don't remember what exactly happens if you use an unnamed system font, so you may want to double check to make sure you aren't doing that. (this was mentioned in the pinned comment)
@risabhkedia2685
@risabhkedia2685 4 жыл бұрын
@@dafluffypotatovr7362 I made all the font names to Arial and the python file works fine the only problem is with the exe. I'll try the print statements and let you know if something goes wrong. Thanks for answering BTW.
@srich-k
@srich-k 4 жыл бұрын
I have made a simple game using Tkinter and pygame after making them as an executable the tkinter windows works fine but the pygame window opens up and crashes instantly displaying nothing with no error.... I have used only two images in the game and loaded them using pygame.image.load() Any fix for this?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Try following the instructions in the pinned comment.
@srich-k
@srich-k 4 жыл бұрын
@@DaFluffyPotato it says Failed to execute script pyi_rth_pkgres..... Any solution to this.....I tried out the thing in the pinned comment
@MegaDixen
@MegaDixen 4 жыл бұрын
no idear why but it is not working for me it's make the file and everything it just failed to execute script when i try to run it
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Read the pinned comment.
@vladimir-sama
@vladimir-sama 4 жыл бұрын
Hello, I got an error with tkinter, pygame, and python 3.8 only on pyinstaller. It says pygame.error: Failed loading libmpg123.dll: the specified module could not be found. Thanks for your time.
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Is that when you run it or when you try to package? If that's during packaging, your Pygame install is likely messed up in some way.
@vladimir-sama
@vladimir-sama 4 жыл бұрын
@@DaFluffyPotato its was during run, the fix was copying libmpg123.dll in the same folder as the exe.
@gansless4720
@gansless4720 4 жыл бұрын
@@vladimir-sama same as me, how can i get the libmpg123 file?
@vladimir-sama
@vladimir-sama 4 жыл бұрын
@@gansless4720 Find your Python install folder go to lib and site-packages: USER\AppData\Local\Programs\Python\Python38\Lib\site-packages\pygame on windows in my case (Python 3.8 64b
@henrypdt
@henrypdt 4 жыл бұрын
I had the same problem, I fixed it by converting the music file from mp3 to wav. The pygame.mixer.music.load one.
Pygame's Performance - What You Need to Know
9:11
DaFluffyPotato
Рет қаралды 210 М.
Convert Python Files To EXE using PyInstaller | PyGame Tutorial
4:25
Coding With Russ
Рет қаралды 100 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 709 М.
Saving and loading in pygame with json
25:23
Clear Code
Рет қаралды 30 М.
Python / Pygame Tutorial: Animations with sprites
14:25
Clear Code
Рет қаралды 124 М.
When Python is too Slow for my Steam Game
5:30
DaFluffyPotato
Рет қаралды 50 М.
PyGame Beginner Tutorial in Python - Adding Buttons
18:55
Coding With Russ
Рет қаралды 178 М.
A Programmer's Guide to Pixel Art
9:28
DaFluffyPotato
Рет қаралды 196 М.
Trigonometry in Game Development
11:26
DaFluffyPotato
Рет қаралды 60 М.
Cameras in Pygame
1:13:21
Clear Code
Рет қаралды 125 М.
Pygame Platformer Tutorial - Full Course
6:05:12
DaFluffyPotato
Рет қаралды 389 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН