<?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: ZoomToSelectedFeature Error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604907#M47261</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check your casing. use:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14599767297276528 jive_macro_code jive_text_macro" data-renderedposition="34_8_1332_16" jivemacro_uid="_14599767297276528" modifiedtitle="true"&gt;&lt;P&gt;arcpy.mapping.MapDocument&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Apr 2016 21:05:41 GMT</pubDate>
    <dc:creator>AndrewKeith3</dc:creator>
    <dc:date>2016-04-06T21:05:41Z</dc:date>
    <item>
      <title>ZoomToSelectedFeature Error</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604906#M47260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Good day,&lt;/P&gt;&lt;P&gt;I am new to python and am having the following problem. If I type the following code into the Python window in ArcMap:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
MXD=arcpy.mapping.mapdocument('CURRENT')
dataframe = arcpy.mapping.ListDataFrames(MXD, "Layers")[0]
dataframe.zoomToSelectedFeatures()
arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;P&gt;It works when run from the python window.&lt;/P&gt;&lt;P&gt;If I save it as a python script and add it to a modelbuilder model then try to run it from there it does not work. &lt;/P&gt;&lt;P&gt;This is the message that displays:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Executing (Zoom To Selected Feature): ZoomToSelected&lt;/P&gt;&lt;P&gt;Start Time: Wed Apr 06 14:30:39 2016&lt;/P&gt;&lt;P&gt;Running script ZoomToSelected...&lt;/P&gt;&lt;P&gt;Failed script ZoomToSelected...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "X:\GIS\LUAM\Dev\Scripts\ZoomToSelected.py", line 2, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD=arcpy.mapping.mapdocument('C:\ESRIPress\GTKModelbuilder\Maps\EX06B.mxd') #get access to the current mxd&lt;/P&gt;&lt;P&gt;AttributeError: 'module' object has no attribute 'mapdocument'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Failed to execute (Zoom To Selected Feature).&lt;/P&gt;&lt;P&gt;Failed at Wed Apr 06 14:30:39 2016 (Elapsed Time: 0.08 seconds)&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;What am I doing wrong with trying to get this to work from modelbuidler?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:56:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604906#M47260</guid>
      <dc:creator>ChrisHolmes</dc:creator>
      <dc:date>2021-12-12T01:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomToSelectedFeature Error</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604907#M47261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check your casing. use:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14599767297276528 jive_macro_code jive_text_macro" data-renderedposition="34_8_1332_16" jivemacro_uid="_14599767297276528" modifiedtitle="true"&gt;&lt;P&gt;arcpy.mapping.MapDocument&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2016 21:05:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604907#M47261</guid>
      <dc:creator>AndrewKeith3</dc:creator>
      <dc:date>2016-04-06T21:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomToSelectedFeature Error</title>
      <link>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604908#M47262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great Andrew. Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2016 21:10:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoomtoselectedfeature-error/m-p/604908#M47262</guid>
      <dc:creator>ChrisHolmes</dc:creator>
      <dc:date>2016-04-06T21:10:07Z</dc:date>
    </item>
  </channel>
</rss>

