AnsweredAssumed Answered

Python tool works in PyCharm and Terminal, but not in ArcMap

Question asked by Oyvind.Idlandgeodata-no-esridist Employee on Feb 12, 2013
Latest reply on Feb 13, 2013 by Oyvind.Idlandgeodata-no-esridist
I have a Python tool that runs fine when executed from PyCharm and DOS-terminals, but fails when I execute it from ArcMap 10, SP5.

Stripped down version of the code looks like this:

try:     toolbox_file = os.path.join(, "MyTools.tbx")     arcpy.ImportToolbox(toolbox_file, "SomeTools")     arcpy.SomeTools.IRAPToESRIVector(.........) except Exception, e:     arcpy.AddMessage("Trying to get some sensible error messages: " + e.message)     msg = arcpy.GetMessages(2)     arcpy.AddError("messages: " + msg)

The output looks like this, with some chinese garble:

Start Time: Tue Feb 12 12:46:07 2013
Running script ToESRIVectorScript...
Importing toolbox: C:\Users\path\to\MyTools.tbx
Processing C:\Users\myself\testdata\p.2.16\File1.irp
Trying to get some sensible error messages: Object: Tool or environment <?????????????????????????????????> not found
Completed script ToESRIVectorScript...
Failed to execute (ToESRIVectorScript).
Failed at Tue Feb 12 12:46:09 2013 (Elapsed Time: 2,00 seconds)

As you can see, arcpy.GetMessages(2) returns nothing at all, while the exception states that something chinese is not found.

This resembles corrupted memory... anybody had similar issues ?