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

This problem is occurring in ArcGIS Server 9.3, Python 2.5.2

I am exposing a typical python script as a geoprocessing service. In this script, I frequently use the gp.ListFeatureClasses() method, which searches the current workspace as shown in snippet below.

import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.workspace = "C:/someworkspace/mygdb.gdb" 
featureClasses = gp.ListFeatureClasses()

In the initial portion of the script, everything works as expected. But in later portions of the script, the service crashes when I call gp.workspace reporting the following error:

AttributeError: Object: Environment <workspace> not found

My initial guess was that maybe the workspace was being set to a non-existent workspace or gdb, but I have been able to verify that the workspace is always infact valid.

Digging around a bit has shown that others have experienced the same problem. However, none have been able to set the workspace AT ALL.

Has anyone ever experienced such issues?

share|improve this question

I have had this issue, and only got around it by reassigning the location for the workspace everytime I wanted to list any featureclasses

share|improve this answer
Thanks for the response - but that is where I getting the error. When I call gp.Workspace = 'C:/new_workspace' in mid-script I get the Object: Environment <workspace> not found error. – user890 Nov 24 '11 at 12:48
Try setting gp.Workspace = null before you reset it, or simply create a string reference to the datasets env location and 'prepend' it – Hairy Nov 24 '11 at 13:25
One last thing to note, is how are you licensed? Is it through a license server? Can you post the whole script up? – Hairy Nov 24 '11 at 13:32
The other thing I do, differently, is pass the environment in as a variable, so it might be acting differently? I don't know, as it is flaky, but it seems to work – Hairy Nov 24 '11 at 13:40
I am starting to think this is, and excuse the pun, an environment issue, as I cannot replicate it doing it the way you are, and mine works fine. Some things I would do, is to bump any license server, reinstall possibly, your instance? How are you running the script? Can you run it in IDLE? – Hairy Nov 24 '11 at 13:48

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.