Just compilation

Cameron Simpson cs at zip.com.au
Tue Feb 4 10:27:44 CET 2014

On 04Feb2014 00:58, Igor Korot <ikorot01 at gmail.com> wrote:
> I'm trying to incorporate the path in
> http://sourceforge.net/p/mysql-python/bugs/325/.
> I already modified the source code and now what I need is to produce
> the pyc code.
> Running "python --help" I don't see an option to just compile the
> source into the bytecode.
> So how do I produce the compiled version of the changed source?
> What I'm thinking is to compile the file update the archive and reinstall.

You want the py_compile module, parse of the stdlib.


  python -m py_compile path/to/foo.py

I use this in my personal test suite as a syntax check.

See the python docs for this module for further details.

Cameron Simpson <cs at zip.com.au>

A friend of mine in a compiler writing class produced a compiler with one error
message "you lied to me when you told me this was a program".
        - Pete Fenelon <pete at minster.york.ac.uk>

More information about the Python-list mailing list