Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

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

$
0
0
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:

Code:

try:
    toolbox_file = os.path.join(arcpy.gp.getMyToolboxesPath(), "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
messages:
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 ?

Viewing all articles
Browse latest Browse all 2485

Trending Articles