AnsweredAssumed Answered

Workspace not set

Question asked by magicianlv on Mar 28, 2012
Latest reply on Mar 28, 2012 by magicianlv
Hello!

In ArcGIS 10 SP4 I am trying to create a Python script to connect to a geodatabase in ArcSDE. For testing purposes, also trying a file geodatabase. I am doing exactly as is suggested in the resource center, yet it doesn't work!

import arcpy from arcpy import env print arcpy.ListEnvironments() env.workspace = r"C:/asdf/asdf.gdb/Convert_Output"  if arcpy.Exists(env.workspace):     print "workspace exists"  print arcpy.env.workspace fcList = arcpy.ListFeatureClasses()


Here goes the output...

[] workspace exists C:/asdf/asdf.gdb/Convert_Output Traceback (most recent call last):   File "<pyshell#25>", line 1, in <module>     import dapimport.py   File "C:\Users\asdf\Desktop\maps\script.py", line 11, in <module>     fcList = arcpy.ListFeatureClasses()   File "C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcPy\arcpy\__init__.py", line 650, in ListFeatureClasses     return gp.listFeatureClasses(*args)   File "C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcPy\arcpy\geoprocessing\_base.py", line 312, in listFeatureClasses     self._gp.ListFeatureClasses(*gp_fixargs(args))) RuntimeError: ERROR 000638: Workspace not set for GeoProcessor.


What's wrong??

Outcomes