AnsweredAssumed Answered

Python Script Works in IDLE but Fails in Pro

Question asked by LeviCecil on Dec 28, 2018
Latest reply on Jan 2, 2019 by dflater-esristaff

I've been dealing with this issue for a couple of months. I have a Python script that converts CAD files to Geodatabase feature classes for nearly 100 facilities. The script runs flawlessly every time in IDLE 2.7.13. When I run the script in a toolbox in ArcGIS Pro 2.2.4, at least half the time the script fails at some point. It's usually on the tools arcpy.AddField_management (error 000852) or arcpy.Merge_management (error000735) . When the script does run to completion in Pro, the resulting feature classes are different from those generated by the standalone script. There are many null features, and/or data is copied from one DWG record to dozens of other features. I believe these errors are caused by record IDs not being correctly copied from a room report CSV using the   arcpy.TableToTable_conversion tool. 

 

I've made sure the script is Python 3 compatible and run the Analyze Tools for Pro tool with no errors. The only differences between the two versions of the script are arcpy.AddMessage functions in place of "print" and hardcoded paths in the standalone version versus arcpy.GetParameterAsText parameters in the ArcGIS Pro toolbox. 

 

Is anyone else having these kinds of problems with ArcGIS Pro? I'm OK with using the standalone script, but I want others to be able to use the tool in Pro. One hypothesis I have is that the script could be failing because ArcGIS Pro is open during the process, possibly due to memory errors. A few times when I have run the standalone script with Pro open and tried to refresh the geodatabase, the standalone script will error out. 

Outcomes