0

I was writing some script and it involved processing a large number of rasters. I hit run and then noticed an parameter I forgot to change.

Is there a way to cancel the script once it has begun so I don't have to either wait for it to finish or close ArcMap?

2
  • 2
    If the script is run within the geoprocessing framework, and checks are done in the app for the cancel button being pushed, then you can handle this gracefully. If it's a standalone Idle (or other IDE) interpreter, then a break might work. After that you're falling back to killing the Python interpreter or Desktop session. I try always add a check for a "stop.now" file at the top of my list processing (if os.path.exists('stop.now'): break), so I have a graceful way to exit long-running loops.
    – Vince
    Commented Mar 10, 2021 at 19:23
  • 2
    It's possible if you are using progressor bar.
    – FelixIP
    Commented Mar 10, 2021 at 19:33

1 Answer 1

0

I recommend following the advice of @Vince:

If the script is run within the geoprocessing framework, and checks are done in the app for the cancel button being pushed, then you can handle this gracefully. If it's a standalone Idle (or other IDE) interpreter, then a break might work. After that you're falling back to killing the Python interpreter or Desktop session. I try always add a check for a "stop.now" file at the top of my list processing (if os.path.exists('stop.now'): break), so I have a graceful way to exit long-running loops.

or that of @FelixIP:

It's possible if you are using progressor bar.

I have not tested but I think both would work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.