Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I add a field to the target FeatureClass it is not present, via arcpy.AddField_management(...). Works fine from PythonWin, but the AddField call fails when the script is run from ArcCatalog. I have this exception catch code:

except Exception as ErrorDesc:
    Errors = "TRUE"
    arcpy.AddMessage("An unknown error occurred:")
    arcpy.AddMessage(ErrorDesc.message)

But the error I get is at the end of this output:

Getting list of fields.
Adding PC field to target.
An unknown error occurred:
Object: Tool or environment <摁䙤敩摬浟湡条浥湥t> not found

And that Mandarin text - is that unicode being mangled?

share|improve this question
    
Are you using a featureset or a featureclass? –  mhoran_psprep Jun 20 '12 at 15:15
    
If you're running this in the python window, give this a try to see if you can get a real error message (instead of the Exception method: print arcpy.GetMessages() –  Roy Jun 20 '12 at 16:13
    
Running stand-alone in a python window there is no error - that's the consternation of it. The target is a FeatureClass. –  jphiloon Jun 20 '12 at 16:32
    
I think you need to refer to a featureset –  mhoran_psprep Jun 20 '12 at 17:10
    
Have you seen this discussion forum thread? forums.arcgis.com/threads/… It may or may not be relevant. –  PolyGeo Jun 20 '12 at 21:56
show 4 more comments

1 Answer

I got a similar issue here, with some chinese random garble (which looks like some junk from memory):

In my case I load a custom toolbox. When I try to execute a tool from this tbx from my script, I got this in ArcMap 10, SP5:

Tool or environment <剉偁潔卅䥒敖瑣牯卟慴潴汩䥇呓潯獬> not found

When running the script from my IDE, or from a terminal window, it works fine.

What I did was to add some additional code to show the contents of the toolbox I just loaded:

toolbox_file = 'C:\Users\path\to\MyTools.tbx'
arcpy.AddMessage('Importing toolbox: ' + toolbox_file)
tbx = arcpy.ImportToolbox(toolbox_file)
if tbx is None:
    arcpy.AddError("Toolbox is null")
else:
    arcpy.AddMessage("debug: listing tools")
    tools = arcpy.ListTools("*MyGISTools*")
    arcpy.AddMessage("Number of tools found: %i" % len(tools))
    for tool in tools:
        arcpy.AddMessage(arcpy.Usage(tool))

In the IDE and the terminal I got a list of all the tools with their parameters, as expected.

However, in ArcMap, I got a bunch of

Method ToESRIRasterScript_MyGisTools not found. Choices: Method ToESRIRasterScript_MyGisTools not unique, please use ToolboxName_ToolName
Method ToIRAPVectorScript_MyGisTools not found. Choices: Method ToIRAPVectorScript_MyGisTools not unique, please use ToolboxName_ToolName.
Method ToESRIVectorScript_MyGisTools not found. Choices: Method ToESRIVectorScript_MyGisTools not unique, please use ToolboxName_ToolName.
Method PrepareIRAPforInput_MyGisTools not found. Choices: Method PrepareIRAPforInput_MyGisTools not unique, please use ToolboxName_ToolName.

This seemed to indicate that something was duplicated. When I removed my toolbox from ArcToolbox, and re-ran it from the Catalog window, it all worked just fine.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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