AnsweredAssumed Answered

How to check if in an Edit Session using python and arcpy

Question asked by vshah6 on Mar 8, 2017
Latest reply on Feb 15, 2018 by jhead@lakeworth

I am currently working on a tool that uses the updateCursor function but the tool needs to be in an edit session to use. However some who may use the tool may end up not being in an edit session before running the tool and get an error. Rather than come ask me every time about the error, I'd like to implement an if statement in the script in the beginning that checks if the user is currently in an edit session, if they are then run tool. if not, a dialogue box explaining they need to be in an edit session and ask if they want the script to turn editor on. Formatted as such:

#if edit session is on:
    #run tool
#elif edit session is off:
    #dialogue box explaining user has to be in edit session and asking if they want the script to turn editor on (Yes or no option):
        #if yes:
            #run tool
        #if no:

I am trying to do this without using the work done by Mark Cederholm as referenced in this post: How do I access ArcObjects from Python?, and code examples provided by Matt Wilkie in his "" file.