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:
<SPAN class="comment token">#if edit session is on:</SPAN>
<SPAN class="comment token">#run tool</SPAN>
<SPAN class="comment token">#elif edit session is off:</SPAN>
<SPAN class="comment token">#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):</SPAN>
<SPAN class="comment token">#if yes:</SPAN>
<SPAN class="comment token">#run tool</SPAN>
<SPAN class="comment token">#if no:</SPAN>
<SPAN class="comment token">#quit</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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 "Snippits.py" file.