Error:  ValueError: Bad marshal data when running Python script

相关信息
Article ID: 40893
Software:
ArcGIS - ArcEditor 10
ArcGIS - ArcInfo 10
ArcGIS - ArcView 10
ArcGIS for Desktop Advanced 10.1
ArcGIS for Desktop Standard 10.1
ArcGIS for Desktop Basic 10.1
Platforms:
Windows XP, Server 2003, Vista, Server 2008, Windows 7, Windows 8, Server 2012

错误信息
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"



错误原因
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:


Version 10.1: • C:\Python27\ArcGIS10.1 • 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)
Version 10.0: • C:\Python26\ArcGIS10.0 • C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy • C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy (if on 32-bit only machine)


创建及修改时间
Created: 2/28/2013

Last Modified: 8/6/2013
原文链接
http://support.esri.com/en/kno ... 40893

要回复问题请先登录注册