Running a Python file directly from PND


vadsamoht

Well-Known Member
Joined
Jun 11, 2010
Messages
1,021
Age
33
Location
South Australia
I've been trying to package my first ports into PND files (ignoring DistPND for now, because I want to understand what is actually going on), but the only way I've been able to get the games to run is by creating a shell script with something along the lines of:



Code:
run.sh

  #!/bin/sh

  python ./game.py

and then setting the exec parameter in the PXML.xml file to:



Code:
<exec command="game.py" background="false" standalone="true" />

which hardly seems elegant. I've tried every permutation of the CL command 'python game.py' I can think of, but none of them work for various reasons (either can't find Python or won't run it properly).


Is there any way to reference the .py file directly, without using a shell script, or do I just have to put up with the extra script?
 
Last edited by a moderator:
as long as the game.py is set executable and have this as first line it should work :


#!/usr/bin/python
Interesting. I had previously set the file to be executable as you suggested, but after disabling and then re-enabling execution it worked! Thanks!
 
A good thing to do when you are packaging up something is to remove the ".py" extension too.


So instead of someone typing "megaman.py", they would just type "megaman".
 
Back
Top