AnsweredAssumed Answered

"Unexpected EOF while parsing" in a very short code

Question asked by aaridd18 on Mar 26, 2012
Latest reply on Mar 26, 2012 by kimo
I'm working on a longer piece of code and wanted to look at a list of rasters in a workspace to make sure I knew the formatting. Trying to create and print a list of raster names has continually raised a syntax error of 'unexpected EOF while parsing' for line six. (This would be followed by an indented "print raster" but I'm checking the syntax as I go).

>>> import arcpy >>> from arcpy import env >>> env.workspace=r"S:\FIRE\ben_data\1973to1980\Eco01" >>> rasterlist=arcpy.ListRasters >>>  >>> for raster in rasterlist: ...     print raster 


Does anyone have insight about why such an error would be raised on such a simple piece of code?

In addition, Python has continually auto-fills the last "raster" with "rasterlist" when I to execute the code block. Why is it doing this? (I understand I can just change that variable name--just wondering out of curiosity).

Outcomes