Select to view content in your preferred language

Error message in PythonWin that I dont understand

1060
2
01-26-2011 12:42 PM
HalilSiddique
Occasional Contributor II
Hi all,
I'm at the very early learning stages of python, so please don't bite 😮

I have the following code

import arcgisscripting
gp = arcgisscripting.create(9.3)
print "Tools imported"

gp.workspace = "C:/Temp"
print "Workspace set"

gp.overwriteoutput = 1
print "Overwrite set"

Input = "COVER63p.shp"
Output = "no_damage.shp"
Erase = "special_regions.shp"
print "variables set"

gp.erase_analysis(Input, Erase, Output)
print "tool has run...success"
print gp.messages()



Which should work, however when i run it in pythonwin (it takes about 15 minutes???) but also outputs this error in the interactive window.

>>> Tools imported
Workspace set
Overwrite set
variables set
tool has run...success
Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript
    exec codeObject in __main__.__dict__
  File "Z:\Data\Halil\Halil\ArcGIS\Python\Python\Homework\Erase.py", line 23, in <module>
    print gp.messages()
AttributeError: Object: Tool or environment <messages> not found
>>>

Can someone explain what it means because I haven't a clue.

Cheers

halil
Tags (2)
0 Kudos
2 Replies
JasonScheirer
Regular Contributor II
Use gp.getmessages(), not gp.messages()
0 Kudos
DanPatterson_Retired
MVP Emeritus
I would also caution people that are using/transitioning to V10 of ArcMap and arcpy that case-sensitivity is an issue, so sloppy case is to be avoided and one should consult the appropriate online help files for the versions of ArcGIS that you are using
0 Kudos