Hi, I want to change the layers's datasource to geodatabase(gdb) instead of sqlite. If I do the operation "Set Data Source" in ArcCatalog that it would make the ArcCatalog crash. I try to change the data source by ArcObjects or ArcPy, but it doesn't work, I can't figure out the solution. Can you help me, please!
Here's my python code
import arcpy.mapping as mapping
mxd = mapping.MapDocument(r"C:\XdApp\data\xd.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\XdApp\data\test.sqlite", r"C:\XdApp\data\test.gdb")
mxd.saveACopy(r"C:\XdApp\data\xd2.mxd")
Solved! Go to Solution.
Hi,
You are trying to change workspace type. findAndReplaceWorkspacePaths can't do that. You need to use replaceWorkspaces from MapDocument, or replaceDatasource from Layer. More info here:
https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/updatingandfixingdatasources.htm
Hi,
You are trying to change workspace type. findAndReplaceWorkspacePaths can't do that. You need to use replaceWorkspaces from MapDocument, or replaceDatasource from Layer. More info here:
https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/updatingandfixingdatasources.htm
Thank you, I really appreciate your help!