I'm running a fairly large script in batch. I've tried it two times now, at it crashes at about 4 hours in and chrashes maybe 20 min into the second batch, giving me the dreaded 99998 error. I've tried to restart both the computer and ArcMap.

ExecuteError: ERROR 999998: Unexpected Error.

I expect it might have something to do with memory, but I had open the task manager while running the script and it only used about ~30 % of the processor and ~30 % memory.

Im not really sure about this, but could it be a problem with arcpy.MakeFeatureLayer_management() or the making of temporary datasets, which I dont delete? An example would be like this:

outCon = Con(viewshed, 1, 0, "value = 0")

I don't delete outCon anywhere, as I thought they might only be temporary.

How would I proceed with that?

  • 1
    post a larger code snippet where you think the issue is originating from along with the exact error message. – NULL.Dude Mar 6 '18 at 13:46
  • @Geo.Dude Sorry, but I only got the "ExecuteError: ERROR 999998: Unexpected Error." with no line to see where it was. This makes me very unsure of where it happens and I don't want to post the whole 600 line code here. – birks Mar 6 '18 at 14:07
  • 1
    You have set arcpy.env.overwriteOutput = True? – BERA Mar 6 '18 at 14:13
  • @BERA Yes, I do that in the start of the script. Could it be that the temporary files don't delete between batches? – birks Mar 6 '18 at 14:15
  • 2
    What you mean when you say "running it in batch"? I would start adding print statements to see where it fails. – BERA Mar 6 '18 at 14:16

Couple things to try:

  1. Turn off background geoprocessing through the Geoprocessing Options dialog. Sometimes this solves the problem with tools getting generic errors.

  2. Add print or Add Message statements to see at what step your code is getting to. This will help you locate the problem in the code, or in a particular file/dataset that might be causing your code to crash. Since you are running in batch mode, it could be a data problem and not a code problem.

  • Thanks! I tried to run geoprocessing in the foreground, but it didn't help. So I think there is something wrong with a file. While running the script in the python window it just chrash the whole program. I tried to catch the 999998 in a try/except, but that doesn't work either. – birks Mar 7 '18 at 10:29
  • Maybe try logging the errors to a file. Also include the file name so you know what file it is working on right before it crashes. docs.python.org/2/howto/logging.html – dslamb Mar 7 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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