I'm trying to run this very simple script to check a problem in another more comlpex one.

import arcpy
arcpy.env.workspace= 'C:\\Users\\Umberto\\Desktop\\Prove_Script\\Karakoram\\temporary_01'

rst= arcpy.listRasters ()
print rst

I didn't find out what's the matter so far. In python console within arcgis it works without any problem. It gives me this error:

Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.1\Lib\site-  packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
    exec codeObject in __main__.__dict__
  File     "C:\Users\Umberto\Documents\UniversitᝐhD\Karakoram\MODIS_Pakistan\Script\test_listClip.py",     line 4, in <module>
    rst= arcpy.listRasters ()
AttributeError: 'module' object has no attribute 'listRasters'

arcpy.ListRasters is capitalised, your code should be:

rst= arcpy.ListRasters ()
  • so simple... Thank You so much, the other time I've been using this function I didn't do such a mistake... – umbe1987 Jan 28 '13 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.