'GPEnvironment' object has no attribute 'extent'

786
5
01-10-2022 08:29 AM
GB_MattPanunto_GISS
Occasional Contributor

I am running a script on 2 different machines, both using the same ArcGIS Pro license. Machine #1 is using ArcGIS Pro v2.7.3, while machine #2 is using ArcGIS Pro v2.9.0.

The script works just fine in v2.7.3, but in v2.9.0, it throws the error: 'GPEnvironment' object has no attribute 'extent'.

There are several places in the script where I'm specifying environment settings, and it throws this GPEnvironment error at each. What could I be missing here?

0 Kudos
5 Replies
JeffK
by MVP Regular Contributor
MVP Regular Contributor

You could view all the attributes in the debugger by setting a breakpoint and look at what's there with:

stuff = arcpy.env

 

See if 'extent' is really there on the machine that is complaining. It is there in my 2.9.  Unless anyone else has any tips or knows where to set a setting for it... maybe needs to be reinstalled on that machine?

0 Kudos
DanPatterson
MVP Esteemed Contributor

Do you know where in your script it is called?  I can only find reference to 

GPEnvironment when referencing overwriteoutput in Production Mapping


... sort of retired...
0 Kudos
GB_MattPanunto_GISS
Occasional Contributor

I maybe should have mentioned in my initial post, but this error only happens during the multiprocessing portion of the script. I didn't think that was an important distinction, but clearly seems to be.

With that, I think I may have stumbled upon something. Looking at the What's new in ArcGIS Pro 2.9 list, it seems this type of error is a new implementation:

GB_MattPanunto_GISS_0-1641836229383.png

 

So, I tested this out by printing a arcpy.ListEnvironments() during the multiprocessor portion for both the v2.7.3 and v2.9.0 machines, and got the same result, shown here:

GB_MattPanunto_GISS_1-1641836555862.png

It seems that most of the environment settings are missing from the multiprocessing environment. Why might that be? This suggests that they were never being set at all on the v2.7.3 machine, as that version wasn't capable of throwing errors for invalid environment names.

 

0 Kudos
Sahaja
by
New Contributor III

Kinda same happened to me. When I upgraded from v2.8 to v2.9 my script to create a multibuffer started giving an error "AttributeError: 'GPEnvironment' object has no attribute 'overwrite'"

I modified my script from this 

#Allow overwriting
arcpy.env.workspace=arcpyenv
arcpy.env.overwrite=True
arcpy.env.overwriteOutput = True

to this:

#Allow overwriting
arcpy.env.workspace=arcpyenv
arcpy.env.overwriteOutput = True

And it worked. Would be keen to know in-depth why is this the case though.

0 Kudos
MarceloRosensaft
New Contributor III

Somebody changed the game rules and didn't dare to tell us. I'm sure somebody from ESRI will jump in and explain

0 Kudos