pyc file usage in a multi OS environment ( newbe question)

Fredrik Lundh fredrik at pythonware.com
Fri Mar 10 12:04:22 EST 2006


"HajoEhlers" wrote:

> Since the  .py file are plain python scripts i assume that these are
> not causing any trouble but what about the  .pyc file ? ( Which i could
> not figure out what they are acutelly for - My knowledge about python
> is more or less a drop of water within the python ocean )

PYC files contain cached compiled Python byte code.  there's also PYO
files, which are optimized PYC files (created by running Python with the
-O flag).

PYC and PYO files are compatible across platforms, but not across major
Python releases (e.g. 2.4.X cannot use 2.3.X byte codes).

note that PYC files are created automatically when PY files are imported
(if there's no newer PYC file already available), and the creation process
is not NFS-safe in itself, so you may end up with assorted race problems
if you're not careful...

</F>






More information about the Python-list mailing list