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.
• 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)