<?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: ArcGIS Server arcpy.mapping service hanging with ESRI basemap in mxd in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452718#M35477</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd love to see the code!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 May 2011 14:13:47 GMT</pubDate>
    <dc:creator>KevinBell</dc:creator>
    <dc:date>2011-05-19T14:13:47Z</dc:date>
    <item>
      <title>ArcGIS Server arcpy.mapping service hanging with ESRI basemap in mxd</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452717#M35476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attempting to create an ArcGIS Server geoprocessing service that exports a map. The service runs a python script that uses the arcpy.mapping module to modify map extent, visible layers, layout elements, etc. of an existing mxd, then export the map. I have run into a problem, though, if the mxd has one of the &lt;/SPAN&gt;&lt;A href="http://www.esri.com/software/arcgis/arcgisonline/standard-maps.html" rel="nofollow noopener noreferrer" target="_blank"&gt;ESRI hosted basemaps&lt;/A&gt;&lt;SPAN&gt; and I run the script through the service. If I run the script locally on the server, it works fine. If I run the script through the service, the code hangs when I call ListDataFrames.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxDoc = arcpy.mapping.MapDocument(r'path\to\mxd')
setVisibleLayers(mxDoc)

def setVisibleLayers(mxDoc):
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataFrame = arcpy.mapping.ListDataFrames(mxDoc)[0] #code hangs here&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code will sit here until the service reaches its timeout, at which point it logs an error, but then, strangely, it completes (usually, though not always). The job status shows failed, but the map gets exported. Below is the message output from ArcGIS Server:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;SPAN style="font-family:&amp;quot;Times New Roman&amp;quot;;"&gt;&lt;STRONG&gt;Job ID&lt;/STRONG&gt;: je327da53fea846d184109dd21edd85d4&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Job Status&lt;/STRONG&gt;: esriJobFailed&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Job Messages&lt;/STRONG&gt;: &lt;BR /&gt;&lt;BR /&gt;esriJobMessageTypeInformative: Submitted. &lt;BR /&gt;esriJobMessageTypeInformative: Executing... &lt;BR /&gt;esriJobMessageTypeInformative: Executing (MapPrint): MapPrint Landscape8x11 -12457810 4955286 -12457587 4955538 0 # "a title" "a subtitle" "some comments" pdf A1234 &lt;BR /&gt;esriJobMessageTypeInformative: Start Time: Wed May 18 08:38:41 2011 &lt;BR /&gt;esriJobMessageTypeInformative: Running script MapPrint... &lt;BR /&gt;esriJobMessageTypeInformative: Setting Visible Layers &lt;BR /&gt;esriJobMessageTypeError: Failed. &lt;BR /&gt;esriJobMessageTypeError: Execution of job je327da53fea846d184109dd21edd85d4 failed because of crash or termination of the server object. &lt;BR /&gt;esriJobMessageTypeInformative: Setting Extent &lt;BR /&gt;esriJobMessageTypeInformative: Setting Layout Text &lt;BR /&gt;esriJobMessageTypeInformative: Adding basemap &lt;BR /&gt;esriJobMessageTypeInformative: Exporting Map &lt;BR /&gt;esriJobMessageTypeInformative: Exported E:\arcgisserver\arcgisoutput\PrintableMap\A1234_130573342519.PDF &lt;BR /&gt;esriJobMessageTypeInformative: Completed script MapPrint... &lt;BR /&gt;esriJobMessageTypeInformative: Succeeded at Wed May 18 08:43:51 2011 (Elapsed Time: 5 minutes 10 seconds) &lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What more is curious is that in a separate log where I have timestamps, the code will get to the ListDataFrames function quickly and sit there for the 5 minute service timeout. Then in a fraction of a second, the rest of the script will be logged and the map will be generated. This could be related to the logger, but the create timestamp of the exported file coincides with the timestamp in the log for when it says it exports.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:11:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452717#M35476</guid>
      <dc:creator>TrentHardy</dc:creator>
      <dc:date>2021-12-11T20:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Server arcpy.mapping service hanging with ESRI basemap in mxd</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452718#M35477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd love to see the code!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 14:13:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452718#M35477</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2011-05-19T14:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Server arcpy.mapping service hanging with ESRI basemap in mxd</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452719#M35478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'd love to see the code!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code in full.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 15:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452719#M35478</guid>
      <dc:creator>TrentHardy</dc:creator>
      <dc:date>2011-05-19T15:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Server arcpy.mapping service hanging with ESRI basemap in mxd</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452720#M35479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you ever figure this out? I have something very similar happing with an arcpy.mapping script. Works on the server but will not run through the service. Same error message as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2012 14:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452720#M35479</guid>
      <dc:creator>ScottDickison</dc:creator>
      <dc:date>2012-04-23T14:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Server arcpy.mapping service hanging with ESRI basemap in mxd</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452721#M35480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having a similar problem with the ESRI basemaps. If I run the export locally, it works, but through the service ("Submit Job")...it exports a map, but the ESRI basemaps (i.e. "World_Street_Map") will not display. Anyone have suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 16:49:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-server-arcpy-mapping-service-hanging-with/m-p/452721#M35480</guid>
      <dc:creator>DanDeneau</dc:creator>
      <dc:date>2012-05-11T16:49:11Z</dc:date>
    </item>
  </channel>
</rss>

