Hi,
I have been running into the same error with trying to run the SynchronizeChanges Data Management tool in a python script between a parent replica and child replica Enterprise Geodatabase. SynchronizeChanges works perfectly fine when run from the toolbox within an active ArcGIS Pro session, but anytime I try to script it it fails.
The script that's served as the basis for this automation is the Python code sample visible form the ArcGIS Pro SynchronizeChanges tool documentation:
# Name: SynchronizeChanges_Example2.py
# Description: Synchronizes changes for a one way replica from the Parent to
# the child replica geodatabase. The parent is an enterprise
# geodatabase workspace, and the child is file geodatabase.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data"
# Set local variables
replica_gdb1 = "MyData.sde"
replica_gdb2 = "Counties_replica.gdb"
replica_name = "MyOneWayReplica"
sync_direction = "FROM_GEODATABASE1_TO_2"
conflict_policy = "" # Not applicable for one way replicas, there is not conflict detection.
conflict_detection = "" # Not applicable for one way replicas, there is not conflict detection.
reconcile = "" # Only applicable for Checkout replicas
# Execute SynchronizeChanges
arcpy.SynchronizeChanges_management(replica_gdb1, replica_name, replica_gdb2,
sync_direction, conflict_policy,
conflict_detection, reconcile)
Despite numerous attempts at running the script, recreating .sde connections, checking folder and file permissions, I continue to run into the same error:
Traceback (most recent call last):
File "F:\IT_GIS\Scripts\Replicas\SynchChange_VecToPub_Daily_Test.py", line 22, in <module>
arcpy.management.SynchronizeChanges(replica_gdb1, replica_name, replica_gdb2,
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2839, in SynchronizeChanges
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2836, in SynchronizeChanges
retval = convertArcObjectToPythonObject(gp.SynchronizeChanges_management(*gp_fixargs((geodatabase_1, in_replica, geodatabase_2, in_direction, conflict_policy, conflict_definition, reconcile), True)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
arcgisscripting.ExecuteError: ERROR 000791: Cannot access local or remote geodatabse.
Failed to execute (SynchronizeChanges).
Has anyone run into a similar issue? This workflow is important to our organization, as we regularly need to push changes made to a production enterprise geodatabase by our members to a read-only database that is used across our organization and with data visible to the public.
Thank you!