code working in PythonWin but not ScriptTool!

Discussion created by dodgyshamrock on Nov 29, 2011
Latest reply on Nov 30, 2011 by dodgyshamrock
Not quite sure how to phrase this question succinctly...  I have a really long code that is working just fine until it gets to a certain point where I am trying to format some list output.  The elements of the list will then be used to populate a table in an Access database.  I've split the list part of the code out and run it in PythonWin and it works.  However, when I run the entire code through the toolbox as a script tool I get this error:

'unicode' object is not callable

on this line:

finalList = [elt[0] + " (" + elt[1] + ")" if type(elt) == list and elt[0] == "ETSc" else str(elt) for elt in outlist]

Is the problem running it through a script tool?  And how would I fix it?  I can't post the entire code as it is over 300 lines but am posting the relevant part below:

#Get ETSc tables
obstable = "L:\\Projects\\IFWapplications\\ETSc\\ETSc.mdb\\tblObservation"
LUtable = "L:\\IFW-Data\\ETSc.gdb\\tblSpatialLU"
SpTab = "L:\\Projects\\IFWapplications\\ETSc\\ETSc.mdb\\tblSpecies"

#Create empty lists
ObsIDList = []
SpeciesList = []
ImpactList = []
outlist = []
finalList = []

#Use Cursor to determine if there is an ETSc record
    HabCur = arcpy.SearchCursor(ProjectSF)
    for row in HabCur:
        VerId = row.getValue("ERVerID")
        habval = row.getValue("HABTYPE")
        if row.HABTYPE == "ETSc":
            EtscList = []
            outetsclist = []
            FID = row.getValue("FEATID")
            fld = "ShapeID"
            whereclause = fld + "=" + "'" + FID + "'"
            LUCur = arcpy.SearchCursor(LUtable, whereclause)
            for row in LUCur:
                obsnum = row.getValue("ObsID")
            del LUCur, row
            for obs in ObsIDList:
                scr = arcpy.SearchCursor(obstable)
                for row in scr:
                    if row.getValue("ObsID") == obs:
                        sp = row.getValue("Species")
                del scr, row
            for species in SpeciesList:
                spcur = arcpy.SearchCursor(SpTab)
                for row in spcur:
                    if row.getValue("SciName") == sp:
                        CommonName = row.getValue("CommonName")
                del spcur, row
                for element in EtscList:
                    if element not in outetsclist:

    #get a list with unique values
    for I in ImpactList:
        if I not in outlist:


    #format elements in list
    finalList = [elt[0] + " (" + elt[1] + ")" if type(elt) == list and elt[0] == "ETSc" else str(elt) for elt in outlist]