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

Discussion in 'Python' started by HajoEhlers, Mar 10, 2006.

  1. HajoEhlers

    HajoEhlers Guest

    Hi folks,
    i have an failover environment for a python application which can
    fail-over to a AIX, Sun or Linux Box.
    At the moment the python interpreter ( 2.4.2 on all platforms ) and the
    application are installed localy but all data and configuration are on
    a shared location ( NFS/GPFS)
    So far no problem.
    But the user are asking to get so called eggs installed which looks
    like some python source code files and some metadata.
    maintain these - eggs - on all platforms.

    So the question arise:
    Can i install python code in a shared location so this code can be
    loaded either from a AIX, Linux or a SunOS box ?

    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 )

    HajoEhlers, Mar 10, 2006
    1. Advertisements

  2. 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...

    Fredrik Lundh, Mar 10, 2006
    1. Advertisements

  3. HajoEhlers

    HajoEhlers Guest

    Thanks for clearifing the issue.

    HajoEhlers, Mar 11, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.