[Python-il] controlling the generation of pyc files

Ori Peleg oripel at gmail.com
Wed Mar 3 15:25:52 IST 2010


One thing to keep in mind when precompiling python files: if the installed
code is being run by different Python versions you can get burned.

On Wed, Mar 3, 2010 at 11:35 AM, Refael Ackermann <refack at gmail.com> wrote:

> This command will try to compile (generate *.pyc files) for all *.py files
> in a certain directory (e.g. c:\code)
>
> python -m compileall -x "svn|hg" c:\code
>
>
>
>
> On Wed, Mar 3, 2010 at 10:59, Amit Dor-Shifer <amitds at oversi.com> wrote:
>
>> Hi all.
>> A process of mine executes a python program, and fails because the
>> python program, being invoked for the first-time, attempts to generate
>> .pyc files in a directory where it has no write permissions.
>>
>> I want to guarantee that pyc files are already present when the process
>> executes the program, or, if that's not feasible, to force the program
>> not to generate them.
>>
>> Seems to me that this is a common issue, hence I thought there exists a
>> common solution. However, I can't put my finger on a common-practice
>> here. The possible directions I've found so-far are:
>>
>> 1. '-B' command line option. Not suited for me because it's >=2.6.
>> 2. use the 'distutils' framework. I'm not familiar with 'distutils', so
>> I'm not sure it actually help me. But even if it can, it seems like a
>> heavy-duty tool, too heavy for this issue.
>>
>> Anyone knows of other options?
>> I'd appreciate feedback - whether I'm on the right track. It looks
>> unnatural to me that such an issue shouldn't have a straight-forward
>> solution.
>>
>> 10x,
>> Amit
>>
>>
>> _______________________________________________
>> Python-il mailing list
>> Python-il at hamakor.org.il
>> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>>
>
>
> _______________________________________________
> Python-il mailing list
> Python-il at hamakor.org.il
> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>
>


-- 
Check out my blog: http://orip.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hamakor.org.il/pipermail/python-il/attachments/20100303/afb710b2/attachment.htm 


More information about the Python-il mailing list