Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Do you have another version of Python installed on your machine that was not put there by the ArcGIS installer? – Jason Jan 6 '12 at 17:24
hi George i've encountered the same problem, you have found a solution for this problem ? – geogeek Jun 25 '12 at 7:43
i can get the name of geodatabase by arcpy.Describe(arcpy.env.workspace).name but i get an empty array using arcpy.ListDatasets("*","ALL") – geogeek Jun 25 '12 at 11:39

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:

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> import os
>>> os.environ['PATH'].split(os.pathsep)
['C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common', 'C:\\Windows\\sys
tem32', 'C:\\Windows', 'C:\\Windows\\System32\\Wbem', 'C:\\Windows\\System32\\Wi
ndowsPowerShell\\v1.0\\', 'C:\\Program Files\\Intel\\DMIX', 'c:\\Program Files (
x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\', 'c:\\Program Files\\Microsoft S
QL Server\\100\\Tools\\Binn\\', 'c:\\Program Files\\Microsoft SQL Server\\100\\D
TS\\Binn\\', 'c:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\V
SShell\\Common7\\IDE\\', 'c:\\Program Files (x86)\\Microsoft SQL Server\\100\\DT
S\\Binn\\', 'C:\\Program Files\\ArcGIS\\ArcSDE\\sqlexe\\bin', 'C:\\Program Files
 (x86)\\GnuWin32\\bin', 'C:\\Program Files\\TortoiseGit\\bin', 'C:\\Cygwin\\lib\
\git-core', 'C:\\Program Files (x86)\\Git\\cmd', 'C:\\Program Files (x86)\\GDAL'
, 'C:\\Python26\\ArcGIS10.0\\Lib\\site-packages\\', 'C:\\Python26\\ArcGIS10.0',
'C:\\Python26\\ArcGIS10.0\\Scripts', 'C:\\Program Files (x86)\\FME2011\\', 'C:\\
Program Files\\TortoiseHg', 'C:\\Program Files (x86)\\GIMP-2.0\\bin', '"C:\\Prog
ram Files\\e-on software\\Vue 9.5 Infinite"', 'C:\\Program Files\\Curl', 'C:\\Mi

Note the paths C:\\Python26\\ArcGIS10.0 and C:\\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?


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):

>>> arcpy.env.workspace = r"D:\Projects\GDBs\slowbutter.gdb"
>>> arcpy.ListDatasets("*", "ALL")
[u'IPAS', u'VIESORE_UK', u'VIESORE_NC', u'NHD', u'USA', u'World', u'NCLiDAR2007'
, u'NCNEDOneNinth', u'IPASHsp100mDEM', u'NCNAIP2005']

Where the first six items are feature datasets and the rest are rasters.

share|improve this answer
Hi Chad! yes I'm running the exact same code. Exactely. It does not crash, just gives me bogus results! – George Jan 6 '12 at 15:32
Chad, I just confirmed it. The environment var PATH is configured correctly with both folders in it. – George Jan 6 '12 at 15:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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