If a script runs in an environment with ArcGIS Pro (arcpy) or in environment without the results are different. The "extent" result is ones an array and the other one is a string with all values:
Example:
<SPAN class="keyword token">import</SPAN> arcgis
<SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>gis <SPAN class="keyword token">import</SPAN> GIS
<SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>geometry <SPAN class="keyword token">import</SPAN> Polygon
gis <SPAN class="operator token">=</SPAN> GIS<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
webmap_search <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>search<SPAN class="punctuation token">(</SPAN>query <SPAN class="operator token">=</SPAN> <SPAN class="string token">'title:"World Regions" AND owner:esri'</SPAN><SPAN class="punctuation token">,</SPAN> item_type <SPAN class="operator token">=</SPAN> <SPAN class="string token">'Feature Layer Collection'</SPAN><SPAN class="punctuation token">)</SPAN>
layer_region <SPAN class="operator token">=</SPAN> webmap_search<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>layers<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
query_result <SPAN class="operator token">=</SPAN> layer_region<SPAN class="punctuation token">.</SPAN>query<SPAN class="punctuation token">(</SPAN>where<SPAN class="operator token">=</SPAN><SPAN class="string token">"REGION='Western Europe'"</SPAN><SPAN class="punctuation token">)</SPAN>
selected_region <SPAN class="operator token">=</SPAN> query_result<SPAN class="punctuation token">.</SPAN>features<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>geometry <SPAN class="keyword token">import</SPAN> Polygon
polygon <SPAN class="operator token">=</SPAN> Polygon<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
<SPAN class="string token">"rings"</SPAN> <SPAN class="punctuation token">:</SPAN> selected_region<SPAN class="punctuation token">.</SPAN>geometry<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'rings'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"spatialReference"</SPAN> <SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="string token">"wkid"</SPAN> <SPAN class="punctuation token">:</SPAN> <SPAN class="number token">3857</SPAN><SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
extent <SPAN class="operator token">=</SPAN> polygon<SPAN class="punctuation token">.</SPAN>extent
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>extent<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Result WITHOUT arcpy:
(-533252.171281941, 5066318.40606212, 1910953.15492337, 7372844.99872111)
Result WITH arcpy (ArcGIS Pro):
-533252.171281941 5066318.40606212 1910953.15492337 7372844.99872111 NaN NaN NaN NaN
This behavior is difficult if you would like to use the same script in different environment.