Is This Content Helpful?
We're glad to know this article was helpful.
This error can occur on any of the ArcGIS-related Python functions or core Python modules. When running a Python script, the script fails and references the following error:
"ValueError: Bad marshal data"
Bad marshal data Python error
A .pyc file ('compiled' Python file) in the Python install folder has become corrupt. These files are used by Python to speed up the start-up and usage of the .py files that are used in scripting.
The problem can be fixed by forcing Python to recompile the bad .pyc file. Delete the bad .pyc file and Python automatically recompiles it the next time the .py file is run. However, because of the number of .py files that a script could reference, it can be hard to track down the individual file that is causing this error. Instead delete all the .pyc files in the Python install.
Delete all the files with .pyc from within the following directories and associated subdirectories:
• C:\Python27\ArcGISx6410.1 (if the 64-bit background geoprocessing upgrade is installed)
• C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy
• C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy (if on 32-bit only machine)
• C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy
• C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy (if on 32-bit only machine)