I know this is a newbie ArcPy question, but here is the deal:
While I'm inside ArcMap 10, the Python window gives me all output correctly, like this:
>>> arcpy.env.workspace = r"C:\uber.gdb"
>>> arcpy.ListDatasets("*","ALL")
[u'uberlandia_urbano', u'Idw_pop2006', u'Idw_pop2000']
But, if I open cmd window (Run > cmd) and type the exact same commands, it will give me an empty list as a result.
I'm pretty sure that the Python version used is the one tied up with arcgis, since I can import arcpy.
Any chance that arcpy does not work on the standard python console?
Best Answer
It should totally run at a Windows command prompt. Sounds like all is well with the install, since you can import arcpy. Make sure that your PATH environmental variable is properly set to the ArcGIS Python install directory, just to be sure. The following from a command prompt on my box:
Note the paths
C:\\Python26\\ArcGIS10.0
andC:\\Python26\\ArcGIS10.0\\Scripts
...these are the standard ArcGIS Python install directories.So you are running the exact same code at the Windows command line as you are inside of ArcMap?
EDIT:
Just tried your exact code on one of my file geodatabases at the Windows command line (same instance that I used above to test my PATH):
Where the first six items are feature datasets and the rest are rasters.