AnsweredAssumed Answered

Python Exception error

Question asked by navjohn on Apr 16, 2013
Latest reply on Apr 17, 2013 by navjohn
I am trying to repair a Python script that has thrown the error:

<type 'exceptions.TypeError'>: exceptions must be classes, instances, or strings (deprecated), not unicode

The part of the code it is referring to is

for upload in uploads:         try:             process(upload,method,doforcenow)         except Arcgisscripting.ExecuteError:      #<< Line where error is reported             msgs = gp.GetMessage(0)             msgs += gp.GetMessages(2)             gp.AddError(msgs)             logMsg("\tError: "+ msgs)             errorOccurred(True)             pass         except:             # Get the traceback object             tb = sys.exc_info()[2]             tbinfo = traceback.format_tb(tb)[0]             pymsg = tbinfo + "\n" + str(sys.exc_type)+ ": " + str(sys.exc_value)             gp.AddError(pymsg)             logMsg("\tError: " +pymsg)             pass

The Python version is 2.5 and it is using ESRI v9.3.1 SP1.

I found a web page that had the Arcgisscripting.ExecuteError part of the exception single quoted.
That didn't work. It simply reported that the exception couldn't be handled.

Can anyone tell me how to fix this error?