Custom modules in process vs. out of process

Discussion created by clint.dow on Feb 18, 2014
Latest reply on Mar 12, 2014 by clint.dow
Hello everyone,

I've recently run into a frustrating problem where my script runs as expected, however crashes at the very end of the script. When I say very end, I mean it will print a message on the very last line of the script before ArcMap and/or Catalog will crash with a Visual C++ runtime error.

I spent a lot of time debugging the code and having it crash over and over in ArcCatalog and ArcMap, however I found that it ran fine from a python console, then remembered the 'Run Python script in process' checkbox. I've unchecked it and my script now (fingers crossed) appears to work, albeit slowly. So, I'm out of panic mode, the script runs, but now I'm curious as to the underlying cause.

When looking up the documentation to figure out why this is the case (, there's this rather unhelpful line:

Running in-process requires that all modules loaded with the Python import directive have the necessary logic to enable them to run in-process. All standard Python libraries, such as os, string, and time, have the necessary logic. However, non standard modules obtained from third parties may not have the necessary logic to run in-process. If you are experiencing unexplainable problems when your script runs, try unchecking the in-process option and running your script again. If the problem goes away when running out-of-process, then there is most likely an issue with one of the modules you imported. In this case, leave the option unchecked.

Can anyone enlighten me as to what the 'necessary logic' in this case is so I can make sure my custom modules contain it going forward? Rather than leaving it unchecked, I'd rather have proper code.

Thanks much!