Making an Executable from a Pygame Game (PyInstaller)

  Рет қаралды 106,258

DaFluffyPotato

4 жыл бұрын

This tutorial goes over the installation and use of PyInstaller for creating executables from Pygame games written in Python.

Пікірлер: 288
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
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 4 жыл бұрын
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 2 жыл бұрын
@@suvradippaul7843 he literally wrote the solution in the comment
@lightpearl1495
@lightpearl1495 2 жыл бұрын
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
@daboxguy3848
@daboxguy3848 3 жыл бұрын
I feel like I can't escape your tutorials. This is going to be very useful. Thanks 👍
@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 😍
@BattleandForge
@BattleandForge 3 жыл бұрын
Made an executable from my first game thanks to this tutorial!
@vitoroliveira8381
@vitoroliveira8381 2 жыл бұрын
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!
@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..?
@ОбидинНиколай
@ОбидинНиколай 18 күн бұрын
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.
@bovfbovf
@bovfbovf 3 жыл бұрын
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 5 ай бұрын
Turn of windows defender and then turn it back on when ur done
@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. 🤗
@xoxogamewolf7585
@xoxogamewolf7585 9 ай бұрын
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 9 ай бұрын
nvm i just tested it with wsl and it worked 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?
@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 👍👍
@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 :)
@alexandertownsend5079
@alexandertownsend5079 3 ай бұрын
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?
@vamakshi811
@vamakshi811 3 жыл бұрын
Thanks for giving solution for every small problem , subscription is asure from my side
@nerdyturkey312
@nerdyturkey312 3 жыл бұрын
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 3 жыл бұрын
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.
@pratamatanar
@pratamatanar 3 жыл бұрын
thank you so much finally the problem that was making me dizzy was finally solved
@emilis173
@emilis173 2 жыл бұрын
thanks, this and some of your other tutorials, super usefull.
@dylanjayabahu2878
@dylanjayabahu2878 3 жыл бұрын
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?
@wojtex4119
@wojtex4119 3 жыл бұрын
Thank you! Now I can share my games with friends, who don't have python installed.
@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.
@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?
@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
@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'
@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?
@dhrumildave4221
@dhrumildave4221 2 жыл бұрын
Thx for this, this is so good
@letsgetcopyright2603
@letsgetcopyright2603 3 жыл бұрын
Best lecture in ever..
@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)?
@JaguarWisdom-9
@JaguarWisdom-9 Жыл бұрын
Thanks, works a treat. Now I can share some mini games. :)
@genericyoutubechanneluwu
@genericyoutubechanneluwu 6 ай бұрын
"alot of people make the mistake of going into build, and looking for the executable," as I'm literally doing that exact thing.
@normalpepsi7993
@normalpepsi7993 Жыл бұрын
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?
@hey9530
@hey9530 2 жыл бұрын
dude ur a lifesaver
@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
@omkakatkar9003
@omkakatkar9003 4 жыл бұрын
Is there a way to create a package of compiled code with all dependencies which needs to be installed once?
@vrajsavani
@vrajsavani 2 жыл бұрын
very usefull! Thank you for this tutorial. 👍
@saturnine.
@saturnine. 3 жыл бұрын
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
@Samuvt2
@Samuvt2 3 жыл бұрын
Does not work, when I open the .exe file it just dont do anything, any fix?
@tunaan80
@tunaan80 Жыл бұрын
For me it says it doesn't recognize pyinstaller as a command
@plexus2000
@plexus2000 2 жыл бұрын
It does not work for me when i put in the file that its in it just says cant find path
@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)
@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...
@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!
@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
@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!)
@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
@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!
@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 :/
@mlphyzix
@mlphyzix Жыл бұрын
Thank you this was very helpful!
@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?
@medveed_
@medveed_ Жыл бұрын
Nuitka: 💀 1 translates code to c 2 nearly impossible to decompile 3 performance boost 4 more compatibility
@thomascasasnovas4372
@thomascasasnovas4372 4 жыл бұрын
Thanks a lot for this tutorial ! It works fine (:
@MRJakeyBro
@MRJakeyBro 4 ай бұрын
'Pyinstaller' is not recognized as an internal or external command, operable program or batch file.
@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.
@pihliss
@pihliss Жыл бұрын
I'm new to PyGame. How can I create this "engine.py" file.
@ibritics
@ibritics 2 жыл бұрын
Do you have a tutorial of the game that you have developed? It looks so cool!!
@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
@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.
@paradoxwjs5578
@paradoxwjs5578 2 жыл бұрын
what needs to be done to export to mobile?
@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)
@matjeijs3289
@matjeijs3289 3 жыл бұрын
where do i find the data folder on 5:36?
@prasoonjha1816
@prasoonjha1816 3 жыл бұрын
My dist folder is empty. What should I do?
@lodostic1015
@lodostic1015 3 жыл бұрын
Retry and wait for it to complete if u think it wasn't completed I guess
@prasoonjha1816
@prasoonjha1816 3 жыл бұрын
@@lodostic1015 Thanks, but it isn't working I think it's a bug as I am using the latest version of Python and they haven't resolved all bugs in latest version.
@hamzakashif7883
@hamzakashif7883 3 жыл бұрын
Failed to obtain/convert traceback! this is the error i get when i run my exe pls help
@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
@t8g0
@t8g0 Жыл бұрын
how can i make the exe include the image
@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
@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
@mlungisindlela6810
@mlungisindlela6810 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.
@jimmypretzel4785
@jimmypretzel4785 3 жыл бұрын
legend thanks for the detailed tutorial!
@IssaalaaRacing
@IssaalaaRacing 3 жыл бұрын
I keep getting fatal error failed to execute file. Why is that?
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Read the pinned comment
@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.
@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 5 ай бұрын
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')
@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
@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.
@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.
@succerzxix1950
@succerzxix1950 4 жыл бұрын
Does the shell not open up when you run the program?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
The -noconsole line removes it
@penguinmaster6510
@penguinmaster6510 3 жыл бұрын
Can you like do it on a mac?
@myszot6804
@myszot6804 2 жыл бұрын
Thanks for good tutorial!, but allways when i'm trying to open the file, windows defender is popping up and deletes it...
@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.
@satwikkar7761
@satwikkar7761 4 жыл бұрын
thnx bro...i really needed this.,.
@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.
@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
@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
@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.
@yabukichoi9133
@yabukichoi9133 4 жыл бұрын
Newbie question, I'm curious if my pygame can be packed to android and play?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
I think I’ve heard there are ways to do it, but I haven’t looked into it.
@FeverDev64
@FeverDev64 4 жыл бұрын
There is . Its called pygame subset for andriod. You should look it up on youtube.
@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.
@alexbaker4511
@alexbaker4511 3 жыл бұрын
It says failed to obtain/convert traceback
@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.
@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 2 жыл бұрын
...he made it...? He literally said in the beginning it contains some of the scripts & assets he uses...
@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.
@gamert2525
@gamert2525 4 жыл бұрын
How can make exe If my pygame project contain 2-3 files Plz help
@cassette7347
@cassette7347 4 жыл бұрын
Maybe try packing them all into one single file?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
It's been a while since I recorded this video, but I believe I mentioned that you just put your files in the same folder as the executable PyInstaller outputs. The easy way to get it working is to put the executable in the same directory as the file you turned into the executable.
@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.
@КостаСтојановић-о8х
@КостаСтојановић-о8х 4 жыл бұрын
Is there a way to change the icon of the .exe file?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Yes. For the file, there’s an option in PyInstaller (I don’t remember what it was though). For the taskbar, it’s either determined by Pygame or PyInstaller depending if you’re on Windows or Linux.
@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.
@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.
@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)
@glakindustries7163
@glakindustries7163 4 жыл бұрын
Help me it still gives me an error: Failed to execute script pyi_rth_pkgres what should i do now??
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Follow the instructions in the pinned comment.
@mega_jc
@mega_jc 4 жыл бұрын
this might help you, it worked for me: github.com/pyinstaller/pyinstaller/issues/2084
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,1 МЛН
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,1 МЛН