<?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: zoomToSelectedExtent or dataDrivenPages.refresh() in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440511#M34507</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In&amp;nbsp; nutshell, the script is used in an MXD with Data Driven Pages.&amp;nbsp; I can see the progression of the script on screen while running.&amp;nbsp; The select statement below is working, but the zoomToSelectedFeatures() does not work and there is no error message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the end of the script when I try the data driven pages refresh, I encounter this error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "T:\1_DOUGLAS_PROJECTS\B_RESEARCH_AND_DEVELOPMENT\3_PROGRAMMING_AND_SCRIPTING\PYTHON\DC_NOTICING_SINGLE.py", line 198, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.refresh()&lt;BR /&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;BR /&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\_mapping.py", line 330, in refresh&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.refresh(*gp_fixargs((args), True)))&lt;BR /&gt;ValueError: PageLayoutObject: Error in refreshing RefreshDataDrivenPages&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument (r"T:\1_DOUGLAS_PROJECTS\A_CLIENT_PROJECTS_ARC\1_INTERNAL_CLIENTS\A_GENERAL_FUND\2_PLANNING_CDEV\C_NOTICING\MXD\ARCGIS10_DC_NOTICING_SINGLE_PARCEL.mxd")
df = arcpy.mapping.ListDataFrames (mxd, "Layers")[0]
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", selstring)
df.zoomToSelectedFeatures()
mxd.dataDrivenPages.refresh()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The "layer" in the select statement is from arc.getParameterAsText(0) with data type in properties parameters set to Layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:42:28 GMT</pubDate>
    <dc:creator>ChadFoster</dc:creator>
    <dc:date>2021-12-11T19:42:28Z</dc:date>
    <item>
      <title>zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440509#M34505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;pre 10.1, I had a script that would zoom to selected features.&amp;nbsp; at 10.1 that same script crashed when it came to zoomToSelectedFeatures().&amp;nbsp; Is this something that is going to become usable again?&amp;nbsp; If not, is there a workaround?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script uses a MXD that has Data Driven Pages enabled, I have also been trying to get dataDrivenPages.refresh() to work, but I keep getting errors.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone experienced either of these situations?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Dec 2012 21:25:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440509#M34505</guid>
      <dc:creator>ChadFoster</dc:creator>
      <dc:date>2012-12-17T21:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440510#M34506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;DF.zoomToSelected() works fine at 10.1.&amp;nbsp; There must be something specific to your code.&amp;nbsp; The same applies to .refresh().&amp;nbsp; It would be much more helpful if you provided a snippet of your code along with the error messages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 14:12:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440510#M34506</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2012-12-18T14:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440511#M34507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In&amp;nbsp; nutshell, the script is used in an MXD with Data Driven Pages.&amp;nbsp; I can see the progression of the script on screen while running.&amp;nbsp; The select statement below is working, but the zoomToSelectedFeatures() does not work and there is no error message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the end of the script when I try the data driven pages refresh, I encounter this error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "T:\1_DOUGLAS_PROJECTS\B_RESEARCH_AND_DEVELOPMENT\3_PROGRAMMING_AND_SCRIPTING\PYTHON\DC_NOTICING_SINGLE.py", line 198, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.refresh()&lt;BR /&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;BR /&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\_mapping.py", line 330, in refresh&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.refresh(*gp_fixargs((args), True)))&lt;BR /&gt;ValueError: PageLayoutObject: Error in refreshing RefreshDataDrivenPages&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument (r"T:\1_DOUGLAS_PROJECTS\A_CLIENT_PROJECTS_ARC\1_INTERNAL_CLIENTS\A_GENERAL_FUND\2_PLANNING_CDEV\C_NOTICING\MXD\ARCGIS10_DC_NOTICING_SINGLE_PARCEL.mxd")
df = arcpy.mapping.ListDataFrames (mxd, "Layers")[0]
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", selstring)
df.zoomToSelectedFeatures()
mxd.dataDrivenPages.refresh()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The "layer" in the select statement is from arc.getParameterAsText(0) with data type in properties parameters set to Layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:42:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440511#M34507</guid>
      <dc:creator>ChadFoster</dc:creator>
      <dc:date>2021-12-11T19:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440512#M34508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The "layer" in the select statement is from arc.getParameterAsText(0) with data type in properties parameters set to Layer.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set the layer name parameter as a string type.&amp;nbsp; Enter a string value that is equal to the layer name in the TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
lyrName = arcpy.getParameterAsText(0)
mxd = arcpy.mapping.MapDocument (r"T:\1_DOUGLAS_PROJECTS\......\_SINGLE_PARCEL.mxd")
df = arcpy.mapping.ListDataFrames (mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0]
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", selstring)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:42:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440512#M34508</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-11T19:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440513#M34509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I made the corrections as you suggested, the script still functions, however the &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;df.zoomToSelectedFeatures()&lt;/PRE&gt;&lt;SPAN&gt; does not do anything and the &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mxd.dataDrivenPages.refresh()&lt;/PRE&gt;&lt;SPAN&gt; still throws an error message.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "T:\1_DOUGLAS_PROJECTS\B_RESEARCH_AND_DEVELOPMENT\3_PROGRAMMING_AND_SCRIPTING\PYTHON\DC_NOTICING_SINGLE.py", line 200, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.refresh()&lt;BR /&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;BR /&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\_mapping.py", line 330, in refresh&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.refresh(*gp_fixargs((args), True)))&lt;BR /&gt;ValueError: PageLayoutObject: Error in refreshing RefreshDataDrivenPages&lt;BR /&gt;&lt;BR /&gt;Failed to execute (SINGLEPARCELNOTICING).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 14:57:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440513#M34509</guid>
      <dc:creator>ChadFoster</dc:creator>
      <dc:date>2012-12-19T14:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440514#M34510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you send a map package and your script to &lt;/SPAN&gt;&lt;A href="mailto:jbarrette@esri.com"&gt;jbarrette@esri.com&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; I'll take a look.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can't send me a map package, at least send my your script so I can look at it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 15:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440514#M34510</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2012-12-19T15:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: zoomToSelectedExtent or dataDrivenPages.refresh()</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440515#M34511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chad. I was going through this exact script and wanted to have it refresh data driven pages. Coincidentally, I stumbled on this post.&lt;/P&gt;&lt;P&gt;This worked:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;ddp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataDrivenPages &lt;SPAN class="comment token"&gt;#creates the object&lt;/SPAN&gt;
ddp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;refrech&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(he worked where I work now and I am updating his script)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:42:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedextent-or-datadrivenpages-refresh/m-p/440515#M34511</guid>
      <dc:creator>DanDeegan</dc:creator>
      <dc:date>2021-12-11T19:42:33Z</dc:date>
    </item>
  </channel>
</rss>

