AttributeError: <unprintable AttributeError object>  when running on ArcGIS10

2396
15
02-18-2011 12:27 PM
hanyhassaballa
New Contributor II
i have installed ArcGIS 10, and i am getting this error:
AttributeError: <unprintable AttributeError object>

when i am trying to run python script that were develop in ArcGIS 9.3, what could be the problem.
Tags (2)
0 Kudos
15 Replies
MelissaDoyle
New Contributor
we are having the same problem after upgrading to ArcGIS 10 - did you find a solution?
0 Kudos
Marion_CountyAuditor
New Contributor III
We got the same error as well - still looking for a solution.....
0 Kudos
JasonScheirer
Occasional Contributor III
Can you paste a full traceback?
0 Kudos
DavidAllen
Occasional Contributor
Can you paste a full traceback?


Did you find a solution? One of my students asked me to help solve this, and I'd look like the hero if I can come up with the answer (or if y'all did and I can steal it!).
0 Kudos
MarcNakleh
New Contributor III
Hi David,

Would it be possible to give, if not a full traceback, then at least the code snippet that was causing the error your student was describing? I've come across this problem in a couple of different contexts, from what I recall, so a bit of context could go a long way 🙂

Cheers,
0 Kudos
yoanndrocourt
New Contributor
Hi every one,
I do have the same problem and I don't know where it comes from...
any suggestion?


# ---------------------------------------------------------------------------
# test.py
# Created on: 2011-10-18 13:50:04.00000
#   (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Load required toolboxes
arcpy.ImportToolbox("C:/Users/Documents/ArcGIS/Sample Tools/SampleTools.tbx")


# Local variables:
ASA_APM_1PNPDK20080622_131859_000000442069_00382_33001_1771_ok_txt = "F:\\front\\trash\\ASA_APM_1PNPDK20080622_131859_000000442069_00382_33001_1771_ok.txt"
ASA_APM_1PNPDK20080622_131859_000000442069_00382_33001_1771_ok_txt__2_ = "F:\\front\\trash\\ASA_APM_1PNPDK20080622_131859_000000442069_00382_33001_1771_ok.txt"
test_shp1_shp = "F:\\front\\trash\\test_shp1.shp"
test_shp1_shp__2_ = "F:\\front\\trash\\test_shp1.shp"

# Process: Create Features From Text File
arcpy.CreateFeaturesFromTextFile_samples(ASA_APM_1PNPDK20080622_131859_000000442069_00382_33001_1771_ok_txt__2_, "local decimal point", test_shp1_shp, "PROJCS['Polar Stereographic',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Stereographic_North_Pole'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-45.0],PARAMETER['Standard_Parallel_1',71.0],UNIT['Meter',1.0]];-30636100 -30636100 147003033.263715;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision")

# Process: Add Field
arcpy.AddField_management(test_shp1_shp, "date", "DATE", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "")

# Process: Calculate Field
arcpy.CalculateField_management(test_shp1_shp__2_, "date", "time.strftime('%d/%m/%Y')", "PYTHON_9.3", "")
0 Kudos
yoanndrocourt
New Contributor
could it be because of the space in the folder name "sample tools"
in this case what to do since when your rename it replacing the space by un underscore the tools doesn't woprk anymore?
0 Kudos
ChristopherStorer
New Contributor
To accurately catch the error, you will need to put your code in a try/catch loop and interpret the error; otherwise, you will always get generic errors like this when you run code.  Try the following (make sure you indent properly):

    try:
        print("Place code here")

    except arcpy.ExecuteError:
        Errors = "TRUE"
        logger.error("An error occurred during geoprocessing:")
        logger.error(arcpy.GetMessages(2))
    except Exception as ErrorDesc:
        Errors = "TRUE"
        logger.error("An unknown error occurred:")
        logger.error(ErrorDesc.message)


Let us know what error you get from this, and we can proceed from there.
0 Kudos
yoanndrocourt
New Contributor
this is the error I get....
doesn't speak much to me...but it says module...could be something doing with the toolboxe?

Traceback (most recent call last):
  File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript
    exec codeObject in __main__.__dict__
  File "F:\front\trash\test.py", line 40, in <module>
    logger.error("An unknown error occurred:")
NameError: name 'logger' is not defined
0 Kudos