.py and .pyc files in read-only directory

Terry twestley at gmail.com
Fri Oct 14 14:04:40 EDT 2011


I'm having a problem with my iPhone/iPad app, Python Math, a Python
2.7 interpreter. All the Python modules are delivered in what Apple
calls the app bundle. They are in a read-only directory. This means
that Python cannot write .pyc files to that directory. (I get a deny
write error when doing this.) I tried using compileall to precompile
all the modules, but now I get an unlink error because Python
apparently wants to rebuild the .pyc files.

I've considered two solutions:
1) Delete all the .py files, delivering only the .pyc, or
2) Redirecting the .pyc files into a separate, writable directory.

Will solution 1) work? I don't know how to do 2) and the only
reference I can find to that are a withdrawn PEP, 304.

Suggestions?



More information about the Python-list mailing list