<?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: Export MXD to pdf script crashing ArcCatalog in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557784#M43610</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I just changed it to an mxd with just a point layer in it as a test and it ran fine, I will have to see what is in the mxd that is causing it to crash.&amp;nbsp; Thanks for the response Dan, if I figure out what is going on with the original mxd causing the crash I will respond here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Feb 2018 21:28:39 GMT</pubDate>
    <dc:creator>RayGreen</dc:creator>
    <dc:date>2018-02-09T21:28:39Z</dc:date>
    <item>
      <title>Export MXD to pdf script crashing ArcCatalog</title>
      <link>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557781#M43607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am kind of new to anything Python and was using the Basic Printing tutorial script from ESRI, but when I try and run it it works for a while and then&lt;/P&gt;&lt;P&gt;my entire ArcCatalog crashes and asks if I would like to send a report.&amp;nbsp; It is just the following code:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os&lt;BR /&gt;import uuid&lt;/P&gt;&lt;P&gt;# Input WebMap json&lt;BR /&gt;Web_Map_as_JSON = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;# The template location in the server data store&lt;BR /&gt;templateMxd = r"c:\test\Template.mxd"&lt;BR /&gt; &lt;BR /&gt;# Convert the WebMap to a map document&lt;BR /&gt;result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)&lt;BR /&gt;mxd = result.mapDocument&lt;/P&gt;&lt;P&gt;# Reference the data frame that contains the webmap&lt;BR /&gt;# Note: ConvertWebMapToMapDocument renames the active dataframe in the template_mxd to "Webmap"&lt;BR /&gt;df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]&lt;/P&gt;&lt;P&gt;# Remove the service layer&lt;BR /&gt;# This will just leave the vector layers from the template&lt;BR /&gt;for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):&lt;BR /&gt; if lyr.isServiceLayer:&lt;BR /&gt; arcpy.mapping.RemoveLayer(df, lyr)&lt;/P&gt;&lt;P&gt;arcpy.env.scratchWorkspace = 'c:/Temp'&lt;BR /&gt; &lt;BR /&gt;# Use the uuid module to generate a GUID as part of the output name&lt;BR /&gt;# This will ensure a unique output name&lt;BR /&gt;output = 'WebMap_{}.pdf'.format(str(uuid.uuid1()))&lt;BR /&gt;Output_File = os.path.join(arcpy.env.scratchFolder, output)&lt;/P&gt;&lt;P&gt;# Export the WebMap&lt;BR /&gt;arcpy.mapping.ExportToPDF(mxd, Output_File)&lt;/P&gt;&lt;P&gt;# Set the output parameter to be the output file of the server job&lt;BR /&gt;arcpy.SetParameterAsText(1, Output_File)&lt;/P&gt;&lt;P&gt;# Clean up - delete the map document reference&lt;BR /&gt;filePath = mxd.filePath&lt;BR /&gt;del mxd, result&lt;BR /&gt;os.remove(filePath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 20:58:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557781#M43607</guid>
      <dc:creator>RayGreen</dc:creator>
      <dc:date>2018-02-09T20:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Export MXD to pdf script crashing ArcCatalog</title>
      <link>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557782#M43608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what did you provide to GetParameterAsText(0) ?&lt;/P&gt;&lt;P&gt;For code formatting see&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;Code formatting... the basics++&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 21:20:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557782#M43608</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-02-09T21:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Export MXD to pdf script crashing ArcCatalog</title>
      <link>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557783#M43609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/396112_getparameterastext.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;I set it up in ArcCatalog as shown above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 21:23:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557783#M43609</guid>
      <dc:creator>RayGreen</dc:creator>
      <dc:date>2018-02-09T21:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Export MXD to pdf script crashing ArcCatalog</title>
      <link>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557784#M43610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I just changed it to an mxd with just a point layer in it as a test and it ran fine, I will have to see what is in the mxd that is causing it to crash.&amp;nbsp; Thanks for the response Dan, if I figure out what is going on with the original mxd causing the crash I will respond here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 21:28:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-mxd-to-pdf-script-crashing-arccatalog/m-p/557784#M43610</guid>
      <dc:creator>RayGreen</dc:creator>
      <dc:date>2018-02-09T21:28:39Z</dc:date>
    </item>
  </channel>
</rss>

