How to suspend script?

2019
11
05-02-2017 01:43 AM
helloworld
New Contributor II

Hello. Is it possible to suspend script execution, then manually edit some tables in ArcGIS and then continue script execution? How can I do it?

11 Replies
RebeccaStrauch__GISP
MVP Emeritus

fwiw, I saw this response and thought it might help with a piece of your task.  It's dealing with SDE (which I don't know that your are), but it has a couple suggestions for starting up an edit session.  just fyi.

https://community.esri.com/message/335518?commentID=335518

0 Kudos
VinceAngelo
Esri Esteemed Contributor

I often write scripts which are designed to run for hours or days, so I usually add a test at the top of major processing loops that check for some condition which would cause graceful termination.  Often it is the existence of a "stop.now" file,  but sometimes it is a "pause.now" which puts the script in a loop waiting for either a "stop.now" to terminate or an absence of "pause.now" to continue.  This would have to be added into your script before execution.

Python script tools (.pyt) can interact with the progress bar in the tool window, but need to be inside an asynchronous arcpy.SetProgressor()/ResetProgressor() session, at which point a try block around arcpy.SetProgressorPosition() will catch a Cancel button press and allow you to handle it gracefully.

- V