What is "marshal data"?

Michael Hudson mwh at python.net
Thu Nov 15 13:53:20 EST 2001


soren at pobox.com (Soren Ragsdale) writes:

> I'm testing some scripts with Python 2.1.1: we're upgrading from
> 1.5.2.  I've been noticing this error, and the REAL problem is that
> I've never heard of "marshal data" before.  This error is not
> reproducible: this script is part of a distributed program which runs
> on about 200 machines, and four of the scripts produced this error. 
> The problem isn't isolated to individual machines:
> 
> > /tip/td/python2-irix64/bin/python -u ren_blade.py 44
> Traceback (most recent call last):
>   File "ren_blade.py", line 4, in ?
>     import uh,gh
> ValueError: bad marshal data
> 
> Possible sources of the problem: "uh.py" is imported from MANY
> programs on our network.  It's being imported by Linux and Irix
> machines running 1.5.2 and 2.1.1 versions of Python.  Could this be
> some sort of race condition, where one platform or version produces a
> .pyc file while the other platform or version is also writing the same
> .pyc file?

Yes, sounds likely.

The problem is that .pycs aren't compatible between 1.5.2 and 2.1.1,
so when Python 2.1.1 tries to load the file and finds a 1.5.2 .pyc it
tries to write a new one, and vice versa.

Can you set things up so the different versions see different copies
of the file?  Another approach would be to write protect the directory
that uh.py is in, though this will impact the performance of imports.

Cheers,
M.

-- 
[1] If you're lost in the woods, just bury some fibre in the ground
    carrying data. Fairly soon a JCB will be along to cut it for you
    - follow the JCB back to civilsation/hitch a lift.
                                               -- Simon Burr, cam.misc



More information about the Python-list mailing list