[BlackBerry-Python] python on Q10

Peter Hansen peter at engcorp.com
Tue Feb 26 10:28:00 EST 2013


On 2013-02-26 04:49, Tarek Galal wrote:
> I tried running my app on Q10 simulator, it crashes on launch. After
> some investigation I found that if I run python3.2 -vv and try to import
> a module, it only looks for compiled modules (.pyc, .pyo, so), so it
> skips looking for py source files.

Ah, I just reread that and I think what you are saying is that in 10.1 
(at least, on the Q10 simulator) the stock python3.2 is actually not 
looking for .py files, but only .pyc files?  And the use of "-vv" was 
merely the way you determined that (?).

That would be a bit of a problem, though not insurmountable I guess. 
The current use of PyRun_SimpleStringFlags() relies on having a .py file 
to compile, I believe.  We could switch this to using .pyc files, but it 
would likely require using something like PyEval_EvalCodeEx() and the 
interface to that is a bit brutal so it would take more setup work to 
make it happen. I picked the simpler approach to begin with.

The reason I left things using .py files for now is that (a) the 
performance impact on smaller apps isn't even measurable (Python 
compilation is very quick), and (b) .pyc files are coupled to a 
particular version of the Python interpreter, and I didn't want to 
commit us all to Python 3.2 until there was more evidence it was what 
would actually be shipped on the devices.

I actually thought they'd move to Python 3.3 to gain the fairly big 
benefits of the improved Unicode handling (see 
http://docs.python.org/3.3/whatsnew/3.3.html#pep-393) and some of the 
other improvements.  It now looks like they'll be on 3.2 for the 
duration and, given that, tying everything to 3.2 versions of the .pyc 
files isn't that big a deal.

I wasn't able to get the 10.1 simulator working on my dev machine but 
I'll see if I can figure out a way to test this out to explore the 
situation.

-Peter


More information about the BlackBerry-Python mailing list