Error setting workspace : attribute not found

3251
7
11-10-2010 07:32 PM
JessB
by
New Contributor
Hello,

I was wondering if anybody else has experienced this. I'm unable to simply set the workspace (or scratchworkspace). The error I get (in PythonWin/Idle/Executing from Toolbox) is:

Traceback (most recent call last):
  File "C:\Projects\PythonScripts\Script34.py", line 13, in <module>
    gp.workspace = "C:/Test"
AttributeError: Object: Environment <workspace> not found

The python script is simple:

import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.workspace = "C:/Test"

Things I've tried:

- Various formats of the path based on ESRI doc
- Checking the versions of Pthon/PythonWin/Numby (and reinstalling several times)
- Running in safe mode
- Looking at event viewer for error
- Using procmon to see if something shows up there
- Setting the license level (per others in the forum with same issue)
- Creating the geoprocessor various ways from ESRI doc

I'm really stuck ... any thoughts as to why this would happen would be MUCH appreciated. Most other properties and methods on the gp seem to work.

Windows 7
ArcGIS Editor Single Use
9.3.1 SP2

Jess
0 Kudos
7 Replies
FrankPerks
New Contributor II
Hello,

I was wondering if anybody else has experienced this. I'm unable to simply set the workspace (or scratchworkspace). The error I get (in PythonWin/Idle/Executing from Toolbox) is:

Traceback (most recent call last):
  File "C:\Projects\PythonScripts\Script34.py", line 13, in <module>
    gp.workspace = "C:/Test"
AttributeError: Object: Environment <workspace> not found

The python script is simple:

import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.workspace = "C:/Test"

Things I've tried:

- Various formats of the path based on ESRI doc
- Checking the versions of Pthon/PythonWin/Numby (and reinstalling several times)
- Running in safe mode
- Looking at event viewer for error
- Using procmon to see if something shows up there
- Setting the license level (per others in the forum with same issue)
- Creating the geoprocessor various ways from ESRI doc

I'm really stuck ... any thoughts as to why this would happen would be MUCH appreciated. Most other properties and methods on the gp seem to work.

Windows 7
ArcGIS Editor Single Use
9.3.1 SP2

Jess


Do you see workspace listed, if you do :

gp.listenviroments()



Other wise what happens if you do this?

import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.clearenviroment("workspace")
print gp.workspace
gp.workspace = "C:/Test"
print gp.workspace
0 Kudos
JessB
by
New Contributor
Listenvironments fails:

Traceback (most recent call last):
  File "C:\Projects\PythonScripts\Script34.py", line 4, in <module>
    gp.listenviroments()
AttributeError: Object: Tool or environment <listenviroments> not found
Traceback (most recent call last):

So does clearenvironments:

Traceback (most recent call last):
  File "C:\Projects\PythonScripts\Script34.py", line 3, in <module>
    gp.clearenviroment("workspace")
AttributeError: Object: Tool or environment <clearenviroment> not found

Maybe another re-install?
0 Kudos
DanPatterson_Retired
MVP Emeritus
http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1028&pid=980&topicname=ListEnvironments_metho...
case-sensitive (at least in 10.0)...consult the online help examples for syntax
for 10.0
>>> import arcpy
>>> arcpy.listenvironments()
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'listenvironments'

fails but this works
>>> arcpy.ListEnvironments()
[u'newPrecision', u'autoCommit', u'XYResolution', u'XYDomain', u'scratchWorkspace', u'terrainMemoryUsage', u'MTolerance', u'compression', u'coincidentPoints', u'randomGenerator', u'outputCoordinateSystem', u'rasterStatistics', u'ZDomain', u'snapRaster', u'projectCompare', u'cartographicCoordinateSystem', u'configKeyword', u'outputZFlag', u'qualifiedFieldNames', u'tileSize', u'pyramid', u'referenceScale', u'extent', u'XYTolerance', u'tinSaveVersion', u'MDomain', u'spatialGrid1', u'cellSize', u'outputZValue', u'outputMFlag', u'geographicTransformations', u'spatialGrid2', u'ZResolution', u'mask', u'spatialGrid3', u'maintainSpatialIndex', u'workspace', u'MResolution', u'derivedPrecision', u'ZTolerance']
0 Kudos
JessB
by
New Contributor
Thanks for your time.

I tried with the correct syntax and still get the error ...

import arcgisscripting
gp = arcgisspcripting.create(9.3)
envs = gp.ListEnvironments("workspace")

yields:

AttributeError: Object: Tool or environment <ListEnvironments> not found.

This all works on other machines, just not on my Windows7 machine. Only thing that I've found (that's suspicious) is if I right click on ArcToolbox to get to the GP settings the form is blank.
0 Kudos
DanPatterson_Retired
MVP Emeritus
gp = arcgisspcripting.create(9.3)
spelling of arcgisscripting...could you confirm that you didn't enter this in error
0 Kudos
JessB
by
New Contributor
Sorry ... replying to the forum on different machine with internet access and retyping by hand.

It is spelled correctly:

import arcgisscripting
gp = arcgisscripting.create(9.3)
envs = gp.ListEnvironments()

I've been able to call tools (RasterToPolygon, AddField, SearchCursor) ... it just seems like anything related to the environment or workspace isn't available ....
0 Kudos
DanPatterson_Retired
MVP Emeritus
gp.listenviroments()
was not spelled correctly your previous link either, so if it isn't a typing thing and what you do works on other machines, then there is something wrong with your installation
0 Kudos