6 Replies Latest reply on Sep 2, 2015 7:28 AM by Stetson Weddle

    AutoUpdater via Python

    Anand Trivedi

      Hello All,

      I am writing to a ArcFMized SDE database via FME Workbench. In this particular case, I want the AUs to be triggered.


      So, in my FME python script, I have this line in my python initializer to make sure the AUs are triggered:


            au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMStandAlone


      However, when I run the script I am getting the following error:

      An error occurred while attempting to store a row into the table 'NISOURCE.GPS_GasMain_Point'. The error number from ArcObjects is: '-2147221164'. The error message from ArcObjects is: {}

      If I disable the AutoUpdater mode by using the following then it all works fine:

      au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMNoEvents

      However, as the auto updaters is disabled, I do not get some of the AU fields populated.

      Can you help me in setting the auto updater correctly? It does appear to be ArcFM issue as disabling the AutoUpdater works fine.

      I also confirmed that AUs are indeed triggered if I manually insert the data via ArcMap.



        • Re: AutoUpdater via Python
          Stetson Weddle

          Anand -


          I assume you are checking out licenses in your code?  It may be that ArcFM is returning an error because there are no licenses available or have not yet been checked out.


          Can you run the tool inside ArcMap to see if the AUs will fire?  You can still use the stand-alone mode if you need to.

          As another test set the AUs to NoEvents to see if you still get the error.  If you still get the error, the AUs don't seem to be the problem.


          Thank you,

          Stetson Weddle

          Technical Lead

          Schneider Electric

            • Re: AutoUpdater via Python
              Anand Trivedi

              Hi Stetson,


              Just to be clear, I am trying to do this within FME environment. Here is the test that I did:


              I disabled AUs by using this line in the FME startup python script:

              au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMNoEvents


              On running FME I get no error. It also uploads the data in the ArcFMized ESRI database - no AUs are triggered and so corresponding attributes are empty.


              When I change the line to this:

              au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMFeederManager


              It throws this error: An error occurred while attempting to store a row into the table 'NISOURCE.GPS_GasMain_Point'. The error number from ArcObjects is: '-2147221164'. The error message from ArcObjects is: {}


              I was also able to edit the same database via ArcMap and can confirm that AUs are being triggered. I was also able to disable them successfully when running  the following code via VBA

              mmAUModeForArcMap.AutoUpdaterMode = mmAUMNoEvents



                • Re: AutoUpdater via Python
                  Anand Trivedi

                  Hi Stetson,


                  I am also attaching the basic code that might be useful. Much of it is the boiler plate code for using ArcFM. And I am using this : app.Initialize(mmLicensedProductCode.mmLPArcFM) to checkout a license:


                  import arcpy, fmeobjects



                  class mmLicenseStatus:

                      mmLicenseAlreadyInitialized  =0x32      # from enum mmLicenseStatus

                      mmLicenseAvailable            =0xa        # from enum mmLicenseStatus

                      mmLicenseCheckedIn            =0x50      # from enum mmLicenseStatus

                      mmLicenseCheckedOut          =0x46      # from enum mmLicenseStatus

                      mmLicenseFailure              =0x28      # from enum mmLicenseStatus

                      mmLicenseNotInitialized      =0x3c      # from enum mmLicenseStatus

                      mmLicenseNotLicensed          =0x14      # from enum mmLicenseStatus

                      mmLicenseRetired              =0x5a      # from enum mmLicenseStatus

                      mmLicenseUnavailable          =0x1e      # from enum mmLicenseStatus



                  class mmLicensedProductCode:

                      mmLPAll                      =0x64      # from enum mmLicensedProductCode

                      mmLPArcFM                    =0x5        # from enum mmLicensedProductCode

                      mmLPArcFMViewer              =0x3        # from enum mmLicensedProductCode

                      mmLPDesigner                  =0x6        # from enum mmLicensedProductCode

                      mmLPDesignerExpress          =0xe        # from enum mmLicensedProductCode

                      mmLPDesignerStaker            =0xd        # from enum mmLicensedProductCode

                      mmLPEngine                    =0x1        # from enum mmLicensedProductCode

                      mmLPEngineViewer              =0x2        # from enum mmLicensedProductCode

                      mmLPEnterprise                =0x64      # from enum mmLicensedProductCode

                      mmLPError                    =0x3e8      # from enum mmLicensedProductCode

                      mmLPGeodatabaseManager        =0xc        # from enum mmLicensedProductCode

                      mmLPNone                      =0x0        # from enum mmLicensedProductCode

                      mmLPResponderDataServices    =0x8        # from enum mmLicensedProductCode

                      mmLPResponderDispatch        =0x4        # from enum mmLicensedProductCode

                      mmLPResponderPrediction      =0x9        # from enum mmLicensedProductCode

                      mmLPServer                    =0x7        # from enum mmLicensedProductCode

                      mmLPServerAdvanced            =0xb        # from enum mmLicensedProductCode

                      mmLPServerReader              =0xa        # from enum mmLicensedProductCode



                  class mmLicensedExtensionCode:

                      mmLXEngineEditor              =0x1        # from enum mmLicensedExtensionCode

                      mmLXInspector                =0x3        # from enum mmLicensedExtensionCode

                      mmLXNetworkAdapter            =0x4        # from enum mmLicensedExtensionCode

                      mmLXNone                      =0x0        # from enum mmLicensedExtensionCode

                      mmLXRedliner                  =0x2        # from enum mmLicensedExtensionCode



                  class mmAutoUpdaterMode:

                      mmAUMNotSet                  =0x0        # from enum mmAutoUpdaterMode

                      mmAUMArcMap                  =0x1        # from enum mmAutoUpdaterMode

                      mmAUMArcCatalog              =0x2        # from enum mmAutoUpdaterMode

                      mmAUMStandAlone              =0x4        # from enum mmAutoUpdaterMode

                      mmAUMNoEvents                =0x8        # from enum mmAutoUpdaterMode

                      mmAUMFeederManager            =0x10      # from enum mmAutoUpdaterMode

                      mmConflictResolution          =0x20      # from enum mmAutoUpdaterMode

                      mmAUMMobileImport            =0x40      # from enum mmAutoUpdaterMode

                      mmAUMMobileExtract            =0x80      # from enum mmAutoUpdaterMode

                      mmAUMPhaseSwap                =0x100      # from enum mmAutoUpdaterMode

                      mmAUMRemoveFromDesign        =0x200      # from enum mmAutoUpdaterMode


                  class mmRuntimeMode:

                      mmRuntimeModeUnknown          =-0x1      # from enum mmRuntimeMode

                      mmRuntimeModeNone            =0x0        # from enum mmRuntimeMode

                      mmRuntimeModeArcMap          =0x1        # from enum mmRuntimeMode

                      mmRuntimeModeArcCatalog      =0x2        # from enum mmRuntimeMode

                      mmRuntimeModeArcEngine        =0x3        # from enum mmRuntimeMode

                      mmRuntimeModeArcServer        =0x4        # from enum mmRuntimeMode

                      mmRuntimeModeEngineViewer    =0x5        # from enum mmRuntimeMode

                      mmRuntimeModeDesignerStaker  =0x6        # from enum mmRuntimeMode



                  app = None

                  runtime = None

                  au = None



                  def initializeArcFM(enableAU):

                      import win32com.client



                      global app, runtime, au

                      app = win32com.client.Dispatch('Miner.Framework.Dispatch.MMAppInitializeDispatch')

                      runtime = win32com.client.Dispatch('Miner.Framework.Dispatch.MMRuntimeEnvironmentDispatch')

                      au = win32com.client.Dispatch('Miner.Framework.Dispatch.MMAutoupdaterDispatch')



                      runtime.RuntimeMode = mmRuntimeMode.mmRuntimeModeArcServer

                      #au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMFeederManager

                      if enableAU==1:

                          #print "arcFm enabled"

                          au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMFeederManager


                          au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMNoEvents


                      print "ArcFM runtime mode", runtime.RuntimeMode




                  def cleanupArcFM():

                      global app, runtime, au

                      if app:


                          del app, au, runtime

                          print "ArcFM shutdown"





              • Re: AutoUpdater via Python
                Stetson Weddle

                Anand -


                Did you see this post in Exchange:  How-To - Work with ArcFM features in Python


                This may help.