[capi-sig] Storing bytecode files in an alternative directory

M.-A. Lemburg mal at egenix.com
Tue Oct 18 14:39:06 CEST 2011


Terry Westley wrote:
> PEP 304 was withdrawn, but those of us embedding Python need a way to put
> .py files in read-only memory and .pyc files in a separate writable
> directory. Short of resurrecting PEP 304, is there a known mod that I could
> use for this purpose?
> 
> My situation is an iPhone/iPad app (http://www.sabonrai.com/PythonMath/).
> Python source files need to be part of the app bundle which is in a
> non-writable directory. I've found that even compiling all the .py files
> doesn't work because the interpreter wants to rebuild .pyc files for certain
> modules and I get an unlink deny error for them.

This should help :-)

> python -h
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-B     : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 18 2011)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the capi-sig mailing list