From twestley at gmail.com Fri Oct 14 17:41:23 2011 From: twestley at gmail.com (Terry Westley) Date: Fri, 14 Oct 2011 11:41:23 -0400 Subject: [capi-sig] Storing bytecode files in an alternative directory Message-ID: 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. Terry From mal at egenix.com Tue Oct 18 14:39:06 2011 From: mal at egenix.com (M.-A. Lemburg) Date: Tue, 18 Oct 2011 14:39:06 +0200 Subject: [capi-sig] Storing bytecode files in an alternative directory In-Reply-To: References: Message-ID: <4E9D736A.3060609@egenix.com> 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/