Adding .py game to retropie ports
-
i made a game in the pycharm environment using 4 packages (pip, pygame, setuptools and wheel). Everything good so far, but now I am utterly confused on how to properly add the .py file to my ports in the RetroPie. my port location is already created since i installed preset games such as quake on my retropie.
as far as i understood i need to create a .sh file and transfer it to my retropie. will this following .sh file work out or do i need to modify it?
#!/bin/bash python /location/to/my/python/script/file.py
how am i supposed to transfer this file (in case it is right) to my ports location on the retropie?
should I use ssh? if so, what is the command to transfer it to my ports?sorry for the amount of questions, I hope i'll find some answers here.
thanks in advance! :)
-
@shou said in Adding .py game to retropie ports:
how am i supposed to transfer this file (in case it is right) to my ports location on the retropie?
https://retropie.org.uk/docs/Transferring-Roms/
should I use ssh? if so, what is the command to transfer it to my ports?
You can use SSH or file shares - it's the fastest method in-case you repeatedly transfer the same files over and over. If you use something like WinSCP (for SSH) or a file explorer (file shares), then there's no need to issue a command - it's just a drag-n-drop operation from your system to the
ports
ROM folder. -
-
@shou said in Adding .py game to retropie ports:
So the .sh script which I wrote above is unnecessary then I assume? I can simply drag in the game.py file into the ports folder?
Keep the
.sh
and put it in the ports folder. The.py
itself can be anywhere since the.sh
points right to it.Suggest putting the
.py
in its own sub-folder:ports/mygame/mygame.py
orports/python_games/mygame.py
for example. -
@sleve_mcdichael @mitu
I am sorry for the very late response!My bash script looks like this:
#!/bin/bash python3 /mnt/D/pycharm/Project/main.py
I transfered the script via WINSCP to the ports location. I can access the file on my retropie but it gets executed and I immediately get back to the port location on my RetroPie.
Anybody know the problem here?Thanks in advance!
-
@shou does the bash script work to launch your game, from the console?
-
Do you mean via the retroPie console with F4?
I did not try it. What is the command for executing it via console?chmod +x /mnt/D/pycharm/Project/main.py
Will this work out or do I need to use the location of the py. File which has been transferred on the retroPie under ports?
-
@shou try executing the script with bash:
bash ~/RetroPie/roms/ports/mygame.sh
-
@sleve_mcdichael
It says there is no such file or directory. -
@shou replacing
mygame.sh
with the actual name of the scriptfile you made and placed into the "ports" folder, of course? Did you get the capital R and P inRetroPie
?Let's back up.
@shou said in Adding .py game to retropie ports:
My bash script looks like this:
#!/bin/bash python3 /mnt/D/pycharm/Project/main.py
If you quit to console with F4 and use this command
python3 /mnt/D/pycharm/Project/main.py
...does the game works? Or, how do you make it work, from outside of RetroPie? Have to make that part work, before we can make it work from inside.
-
@sleve_mcdichael
yes, I considered the Capital R and P and I alos used the name of the originally file which i called "rungame.sh".@sleve_mcdichael said in Adding .py game to retropie ports:
python3 /mnt/D/pycharm/Project/main.py
Using this command in console of retropie gives the same response as the previous one: No such file or directory.
Well to start the game outside of retropie I just open the python file which is saved on my Windows 10 Compter. Do I need to convert this file before uploading it to retropie?
-
@shou said in Adding .py game to retropie ports:
python3 /mnt/D/pycharm/Project/main.py
Using this command in console of retropie gives the same response as the previous one: No such file or directory.
Well to start the game outside of retropie I just open the python file which is saved on my Windows 10 Compter. Do I need to convert this file before uploading it to retropie?
It looks like Python itself is unable to find the
main.py
file at that location. That looks like path to a mounted network drive; are you sure it is mounted right?I think you need to either figure out your network mount, or actually copy the file onto the retropie instead of run it off the network mount.
-
@sleve_mcdichael
My bad, I explained it incorrectly.
The original file is located in my Hard drive D: on my windows 10.I used WINSCP to connect from my windows 10 to my RetroPie. There I copied the file from my computer onto my RetroPie by drag and drop it in the Ports folder.
-
There I copied the file from my computer onto my RetroPie by drag and drop it in the Ports folder.
Then try:
python3 ~/RetroPie/roms/ports/main.py
Or if you've put it in a subfolder,
python3 ~/RetroPie/roms/ports/subfolder/main.py
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.