Select to view content in your preferred language

Python Toolbox - set extent working when run through IDE, not when run through toolbox

427
1
08-01-2022 05:41 PM
I_AM_ERROR
Occasional Contributor

Having an odd issue with a python toolbox that I'm assuming is related to parameter validation. 

Overview...

  • toolbox iterates through an input layer in a map layout
  • for each record in the input layer, def query is set (i.e. OID = 1), and extent object of the layer w/ def query is retrieved through temp_extent = mapframe.getLayerExtent()
  • map frame in the layout is panned to the record by using mapframe.setExtent(temp_extent)

Issue:

  • if I'm executing code through my IDE (VS Code) functionality is fine. camera.x and camera.y coordinates are updating as they should be.
  • If i'm running as a python toolbox in ArcGIS Pro (2.9.3) camera coordinates are not being set properly, only being set to (0,0)

 

I'm following the recommended debug workflow as listed here https://www.esri.com/arcgis-blog/products/arcgis-desktop/analytics/how-to-debug-python-toolboxes-in-....

 

This was working fine in 2.8.3 but not after we updated to 2.9.3.

 

 

Tags (2)
0 Kudos
1 Reply
by Anonymous User
Not applicable

That is frustrating when it works before an upgrade but not after.  Sharing your code would help find what the issue may be.

I take it you mean mapframe.camera.setExtent(...)?

0 Kudos