RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Adding .py game to retropie ports

    Scheduled Pinned Locked Moved Help and Support
    retropiepyhtonraspbianretropiesetuppygame
    14 Posts 3 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      shou
      last edited by

      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! :)

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @shou
        last edited by

        @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.

        S 1 Reply Last reply Reply Quote 0
        • S
          shou @mitu
          last edited by

          @mitu
          I see, thank you very much.
          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?

          S 1 Reply Last reply Reply Quote 0
          • S
            sleve_mcdichael @shou
            last edited by sleve_mcdichael

            @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 or ports/python_games/mygame.py for example.

            S 1 Reply Last reply Reply Quote 1
            • S
              shou @sleve_mcdichael
              last edited by

              @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!

              S 1 Reply Last reply Reply Quote 0
              • S
                sleve_mcdichael @shou
                last edited by

                @shou does the bash script work to launch your game, from the console?

                S 1 Reply Last reply Reply Quote 0
                • S
                  shou @sleve_mcdichael
                  last edited by

                  @sleve_mcdichael

                  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?

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    sleve_mcdichael @shou
                    last edited by sleve_mcdichael

                    @shou try executing the script with bash:

                    bash ~/RetroPie/roms/ports/mygame.sh
                    
                    S 1 Reply Last reply Reply Quote 0
                    • S
                      shou @sleve_mcdichael
                      last edited by

                      @sleve_mcdichael
                      It says there is no such file or directory.

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        sleve_mcdichael @shou
                        last edited by sleve_mcdichael

                        @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 in RetroPie?

                        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.

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          shou @sleve_mcdichael
                          last edited by

                          @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?

                          S 1 Reply Last reply Reply Quote 0
                          • S
                            sleve_mcdichael @shou
                            last edited by sleve_mcdichael

                            @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.

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              shou @sleve_mcdichael
                              last edited by

                              @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.

                              S 1 Reply Last reply Reply Quote 0
                              • S
                                sleve_mcdichael @shou
                                last edited by

                                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
                                
                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post

                                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.