<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem: activeView always None in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146001#M51746</link>
    <description>&lt;P&gt;&amp;nbsp;No clue then because if I have a mapview selected/activated and run it using a notebook or the python window run from &lt;EM&gt;within&amp;nbsp;&lt;/EM&gt;Pro, there are no issues.&amp;nbsp; Outside of Pro, it doesn't work, but I have a standalone install and not subject to any other constraints (portal and the lot)&lt;/P&gt;</description>
    <pubDate>Sun, 20 Feb 2022 18:54:42 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-02-20T18:54:42Z</dc:date>
    <item>
      <title>Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145963#M51729</link>
      <description>&lt;P&gt;Running ArcGIS Pro 2.9.1 on Windows 10 Enterprise v. 1607 (OS Build 14393.4886), also Windows 10 v. 20H2 (OS Build 19042.1526).&lt;/P&gt;&lt;P&gt;Problem: activeView always returns None. Steps to reproduce:&lt;/P&gt;&lt;P&gt;1) Create new Map project.&lt;/P&gt;&lt;P&gt;2) Open Notebook or Python Window&lt;/P&gt;&lt;P&gt;3) Include this code taken from &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapview-class.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapview-class.htm&lt;/A&gt; :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import arcpy, os&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aprx = arcpy.mp.ArcGISProject('current')&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;mv = aprx.activeView&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;# Change the extent of the map view&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ext = mv.camera.getExtent()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4) Result:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;---------------------------------------------------------------------------&lt;/SPAN&gt;
&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;                            Traceback (most recent call last)
In  &lt;SPAN class=""&gt;[16]&lt;/SPAN&gt;:
Line &lt;SPAN class=""&gt;7&lt;/SPAN&gt;:     ext = mv.camera.getExtent()

&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;: 'NoneType' object has no attribute 'camera'
&lt;SPAN class=""&gt;---------------------------------------------------------------------------&lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;aprx.activeMap works, as does aprx.activeMap.defaultView, but I'm pretty limited if I can't manipulate the camera!&lt;/P&gt;&lt;P&gt;The docs say "The &lt;SPAN class=""&gt;activeView&lt;/SPAN&gt; property is intended for scripts that are to be executed in the &lt;SPAN class=""&gt;ArcGIS Pro&lt;/SPAN&gt; application, such as scripts run in the &lt;SPAN class=""&gt;Python&lt;/SPAN&gt; pane or those associated with a &lt;A href="https://pro.arcgis.com/en/pro-app/2.9/help/analysis/geoprocessing/basics/create-a-python-script-tool.htm" target="_blank" rel="noopener"&gt;script tool&lt;/A&gt;", which is what I'm trying. What am I missing?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-- Andy&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 01:08:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145963#M51729</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-02-20T01:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145965#M51730</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/camera-class.htm" target="_blank"&gt;Camera—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapview-class.htm" target="_blank"&gt;MapView—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The second link sounds like your situation&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 02:46:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145965#M51730</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-20T02:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145990#M51740</link>
      <description>&lt;P&gt;Yes, the second link is where I'm getting the sample code that doesn't work. I also just tried it with ArcGIS Pro 2.8.3, and it failed there, too.&lt;/P&gt;&lt;P&gt;Is there some other way to access the active MapView or a list of MapViews in a project? The ArcGISProject object provides methods to access a list of Maps and a list of Layouts, but only the latter can access Cameras, because they know about their MapFrames (analogous to MapViews) and the latter know about their Cameras.&lt;/P&gt;&lt;P&gt;-- Andy&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 17:26:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145990#M51740</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-02-20T17:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145992#M51741</link>
      <description>&lt;P&gt;I don't think anything has changed from the limitations posted in the second link and those posted by esri staff in this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/zoom-to-layer-on-the-map-view-arcpy-mp/m-p/1046096" target="_blank"&gt;Solved: Zoom to layer on the map view arcpy.mp - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 18:02:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145992#M51741</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-20T18:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145998#M51744</link>
      <description>&lt;P&gt;Thanks for that link, it didn't show up when I searched for possible solutions.&lt;/P&gt;&lt;P&gt;And from my reading, I'm not subject to the limitations described because I am running my code within "the application", that is ArcGIS Pro.&lt;/P&gt;&lt;P&gt;-- Andy&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 18:25:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1145998#M51744</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-02-20T18:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146001#M51746</link>
      <description>&lt;P&gt;&amp;nbsp;No clue then because if I have a mapview selected/activated and run it using a notebook or the python window run from &lt;EM&gt;within&amp;nbsp;&lt;/EM&gt;Pro, there are no issues.&amp;nbsp; Outside of Pro, it doesn't work, but I have a standalone install and not subject to any other constraints (portal and the lot)&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 18:54:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146001#M51746</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-20T18:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146002#M51747</link>
      <description>&lt;P&gt;How are you selecting/activating a MapView?&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 19:10:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146002#M51747</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-02-20T19:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146004#M51749</link>
      <description>&lt;P&gt;try an alternate way... you have to know which view or its index you want&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;m0 = aprx.listMaps()[0]
c = m0.defaultView.camera
ext = c.getExtent()
print(ext)
299996.388450461 4999999.22702228 300015.611549539 5000015.77297772 NaN NaN NaN NaN&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;dir(c)
['X', 'Y', 'Z', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__',
 '__eq__', '__format__', '__from_scripting_arc_object__', '__ge__',
 '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__',
 '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__',
 '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
 '__subclasshook__', '__weakref__', '_arc_object', 'getExtent', 'heading',
 'mode', 'pitch', 'roll', 'scale', 'setExtent']&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 20 Feb 2022 20:05:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146004#M51749</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-20T20:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146006#M51750</link>
      <description>&lt;P&gt;Yeah, that's the default view, which is a&amp;nbsp; property of the Map, and apparently loaded when you open a map. I can do this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;extent = arcpy.Extent(-74,42,-72,44)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;c.setExtent(extent)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;print(c.getExtent())&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;-74 42 -72 44 NaN NaN NaN NaN&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;But that's ignored -- the MapView is not updated. Or, if I close the map and reopen it, the defaultView is reset to Esri's default (and why is that the US? Inquiring minds want to know!).&lt;/P&gt;&lt;P&gt;Thanks for the suggestions!&lt;/P&gt;&lt;P&gt;-- Andy&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 23:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1146006#M51750</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-02-20T23:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem: activeView always None</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1148339#M52042</link>
      <description>&lt;P&gt;I found confirmation of this issue here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/zoom-to-layer-on-the-map-view-arcpy-mp/m-p/1147618/highlight/true#M63870" target="_blank"&gt;https://community.esri.com/t5/python-questions/zoom-to-layer-on-the-map-view-arcpy-mp/m-p/1147618/highlight/true#M63870&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The problem is that a Notebook is also a "view", and is technically the active view (even though it still shows null). If the code is in a script file, the correct active view is returned.&lt;/P&gt;&lt;P&gt;The solution is in version 3.0 of ArcGIS Pro, forthcoming at this date. It will correctly provide the active view, whether a map or a layout, and provide some additional methods for maps and layouts to open views for themselves.&lt;/P&gt;&lt;P&gt;-- Andy&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 14:30:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problem-activeview-always-none/m-p/1148339#M52042</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-02-27T14:30:25Z</dc:date>
    </item>
  </channel>
</rss>

