Publish reconcile branch version using ArcPy as web tool return editing error result

139
0
06-23-2022 12:05 AM
Labels (3)
CSM
by
New Contributor

I need to write a reconcile version script and publish it as web tool. After I publish the python script as web tool then execute, I got this error message:

  1. Starting reconcile.
  2. Reconciling version USER.MyVersion with SDE.DEFAULT.
  3. Warning: Error starting editing on version USER.MyVersion.
  4. 1 of 1 versions finished.
  5. Finished reconcile.

If I run the script using ArcGIS Pro Desktop it shows reconcile successfully. However when publish the script as web tool and execute it returns starting editing on version error.

 

Below is the sample script that I wrote:

import arcpy, sys, datetime, os, tempfile, shutil
from arcpy import env

def main():
    
    arcpy.env.overwriteOutput = True
    
    url = "https://mysite.mydomain/server/rest/services/ElectricNetwork/FeatureServer"
    version = "USER.MyVersion"
    post_desc = "N"
    portal_user = "user"
    portal_pwd = "password"
    portal_url = "portal_url"
    
    with_post = "NO_POST"
    
    if post_desc == "Y":
        with_post = "POST"
        
    workspace = url 

    arcpy.env.workspace = workspace
    arcpy.SignInToPortal(portal_url, portal_user, portal_pwd)
    
    reconcileLog = r'C:\NewFolder\Reconcile_Log.txt'


    result = arcpy.ReconcileVersions_management(workspace, 
                                "ALL_VERSIONS", 
                                "SDE.DEFAULT", 
                                version, 
                                "LOCK_ACQUIRED", 
                                "ABORT_CONFLICTS", 
                                "BY_OBJECT", 
                                "FAVOR_EDIT_VERSION", 
                                with_post, 
                                "KEEP_VERSION", 
                                reconcileLog)
    
    if len(result.getMessages(1)) > 0 :                
        arcpy.AddWarning ((result.getMessages(1)))
    else:
        arcpy.AddMessage ("Version reconciled successfully.")

if __name__ == "__main__":
    main()

 

I did google about this error and there's no solution. And also the return message is very limited as it only shows error starting editing on version. Anyone have encounter this problem? Or have any solution about this?

 

Thanks for any suggestions!

0 Kudos
0 Replies