Does Python Need Cross Compiling To Run On The Pandora?


Doomworks

Still Fresh
Joined
Aug 3, 2010
Messages
7
Age
29
Location
England
Hey guys,

I've started learning python and i was wondering if it needs cross compiling to run on a pandora?

thanks

Doomworks
 
I'm not a coder in any form, myself, but I'm pretty sure that it doesn't. Don't quote me on that, though. :p
 
Python is an interpreted language, so Python scripts can run on any platform that has the Python interpreter.
However, if you use an external library such as pygame, you will need a version of it for your architecture.

The interpreter has already been compiled and should be packaged somewhere, pygame probably has ARM packages somewhere. You shouldn't have to do any compiling yourself, unless you have a special library that nobody's compiled for ARM yet.
 
Thanks, can someone point me in the direction of a python interpreter thats been compiled for ARM?


Edit: Never mind
 
Doomworks said:
Thanks, can someone point me in the direction of a python interpreter thats been compiled for ARM?

Read what I just put :)
 
Last edited by a moderator:
Just to add,

I am trying to learn python myself. I made a crappy game on my pc before I got my pandora with python and pygame, when I received my lovely pandora I put my game onto an sd card plugged it in and it worked straight away, touch screen and everything. (except from having to change the odd file location)

CJ
 
DrCJBoduma said:
Just to add,

I am trying to learn python myself. I made a crappy game on my pc before I got my pandora with python and pygame, when I received my lovely pandora I put my game onto an sd card plugged it in and it worked straight away, touch screen and everything. (except from having to change the odd file location)

CJ
Have you any feel for how quick pygame runs on the Pandora?
 
Last edited by a moderator:
may88 said:
DrCJBoduma said:
Just to add,

I am trying to learn python myself. I made a crappy game on my pc before I got my pandora with python and pygame, when I received my lovely pandora I put my game onto an sd card plugged it in and it worked straight away, touch screen and everything. (except from having to change the odd file location)

CJ
Have you any feel for how quick pygame runs on the Pandora?
Afraid not, my game was so simple it didn't really push the pandora at all.
 
Last edited by a moderator:
DrCJBoduma said:
may88 said:
DrCJBoduma said:
Just to add,

I am trying to learn python myself. I made a crappy game on my pc before I got my pandora with python and pygame, when I received my lovely pandora I put my game onto an sd card plugged it in and it worked straight away, touch screen and everything. (except from having to change the odd file location)

CJ
Have you any feel for how quick pygame runs on the Pandora?
Afraid not, my game was so simple it didn't really push the pandora at all.

Rapidpoobears drawing app was aparently much slower (based on my reports) but we're not sure.

I think it's the SDL that needs optimising maybe.
 
Last edited by a moderator:
lulzfish said:
Python is an interpreted language
Absolutely right for ARM, but for x86 we can also use JIT compilers like Psyco.
 
Last edited by a moderator:
The Python in the Pandora OS is missing a lot of stuff (out of requirement, really.). So be careful and be prepared to have to either make some exceptions or possibly package some python modules in your PND if this is possible.
 
may88 said:
DrCJBoduma said:
Just to add,

I am trying to learn python myself. I made a crappy game on my pc before I got my pandora with python and pygame, when I received my lovely pandora I put my game onto an sd card plugged it in and it worked straight away, touch screen and everything. (except from having to change the odd file location)

CJ
Have you any feel for how quick pygame runs on the Pandora?
Short answer; not that fast but not that slow.

Long answer; Onee-sama Tasukete! is a 400x240 game and I can probably get away with parallax scrolling and lazy updating easily while hitting 30 fps. Fortunately Pygame (which comes installed with Python) will let you fix the framerate so if you can consistently get over 30 fps, just lock it there.

What my game engine is currently doing is creating two offscreen 440x280 (tiles are 20x20) surface buffers. One I treat as the "backbuffer" and the other holds the tiles for the background of my level. When the player scrolls a whole tile, it'll only update the newly exposed background tiles. That's the only serious optimization I've made. Every pass it blits the background onto the backbuffer, then blits the sprites on there, then scales the entire thing (offset for player position of course) to the screen.

Adding a bunch more background buffer steps in there didn't impact performance much. We're talking going from 62 fps to 54 fps with like 6 or 7. Plenty for parallax scrolling and such at 30 fps, in my case, and I'm not even doing anything super efficient to update the screen.

Course I'm also only running 400x240. If you wanna make a game at 800x480 you'll have to be more efficient which would in my case also probably mean parallax scrolling is out, since there's no way to do that and not update the entire screen when scrolling. But it should still definitely be possible to get over 30 fps out of that, assuming you blit efficiently enough.

paulguy said:
The Python in the Pandora OS is missing a lot of stuff (out of requirement, really.). So be careful and be prepared to have to either make some exceptions or possibly package some python modules in your PND if this is possible.
Can you name some modules it's missing? I haven't run into this myself so I'm curious.
 
Last edited by a moderator:
Eniko said:
Can you name some modules it's missing? I haven't run into this myself so I'm curious.
platform.py for a start. I also suspect that _socket.py is badly compiled (it's a c module for low level interfacing. I started to look into the problems, then realised we have 2.6.2, wheras I have built 2.6.4 and 2.7 (both of which will run sonata-which was my test target)
 
Last edited by a moderator:
Eniko said:
Boo hiss missing modules.
Fortunately, they're all available in Angstrom, they're just in separate packages (but can be all included with one metapackage). You can install that yourself with opkg, but we should convince ED to include them in the Pandora firmware.
 
Last edited by a moderator:
Tempel said:
Eniko said:
Boo hiss missing modules.
Fortunately, they're all available in Angstrom, they're just in separate packages (but can be all included with one metapackage).

I don't think this is true. I had to get playform.py from my ubuntu box, and sockets only worked properly when I compiled from source. This is not the 'add in' modules, it is the basic python install.
 
Last edited by a moderator:
tsh said:
Tempel said:
Eniko said:
Boo hiss missing modules.
Fortunately, they're all available in Angstrom, they're just in separate packages (but can be all included with one metapackage).
I don't think this is true. I had to get playform.py from my ubuntu box, and sockets only worked properly when I compiled from source. This is not the 'add in' modules, it is the basic python install.
Installing the python-misc pacakge (sudo opkg update && sudo opkg install python-misc) will get you platform.py. Installing the python-io package will get you socket.py (if it doesn't work properly, that just means the package needs updating). I just tested this on my Touch Book, which also runs Angstrom.

I know they're part of the Python standard library, but Angstrom breaks up the standard library into individual packages. See, Angstrom is intended for embedded platforms; if your embedded platform is running a Python application, you can reduce your necessary storage by only installing the parts of the standard library that your application needs. As far as I know, all of the standard library is available in Angstrom, just not installed on the Pandora by default. But given the nature of the Pandora (more a personal computer than an embedded system), I think we should lobby to have the complete standard library included by default.
 
Last edited by a moderator:
Back
Top