# Python scripts runs from PythonWin but not ArcCatalog (ArcGIS 10)

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"


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

Getting list of fields.
An unknown error occurred:


And that Mandarin text - is that unicode being mangled?

-
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

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'
tbx = arcpy.ImportToolbox(toolbox_file)
if tbx is None:
else:
tools = arcpy.ListTools("*MyGISTools*")
arcpy.AddMessage("Number of tools found: %i" % len(tools))
for tool in tools:


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