Hi,
I am using ArcGIS 10.2.1 on Windows 7 64 bits.
I have got an unexpected error when running this code:
import arcpy
inmxd = r'C:\GIS\mymxd.mxd'
infolder = r'C:\GIS\shapefiles'
outgdb = r'C:\GIS\myGDB.gdb'
mxd = arcpy.mapping.MapDocument(inmxd)
mxd.replaceWorkspaces(infolder,'NONE',outgdb,'FILEGDB_WORKSPACE')
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\_mapping.py", line 915, in replaceWorkspaces return convertArcObjectToPythonObject(self._arc_object.replaceWorkspaces(*gp_fixargs((old_workspace_path, old_workspace_type, new_workspace_path, new_workspace_type, validate), True))) ValueError: MapDocObject: Unexpected error |
If I use "SHAPEFILE_WORKSPACE" instead of "NONE" in replaceWorkspaces, then it works. But I want to be able to redirect both rasters and shapefiles from a folder to a file geodatabase. According to the documentation, "NONE" is the option to use when multiple workspaces need to be redirected.
I have tried the code in both the Python window or in a script and I get the same error.
Any idea please?
Joseph