<?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: ArcCatalog(10.5.1)/ArcGIS Server (10.6.1) crash when running arcpy script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165608#M12719</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had the same problem, the symptoms were #1 it weren't reaching further code after using the connection file to the arcgis server (like the&amp;nbsp;&lt;SPAN style="color: #0f243e; background-color: #ffffff;"&gt;CreateMapSDDraft or the UploadServiceDefinition_server calls) so I came to the conclusion something was wrong in the server connection file. #2 the connection files worked fine in Arcmap which was really confusing, then I noticed it worked there but was asking to accept and invalid server certificate. #3 No logs were added to the ArcGIS server, like Arcpy was unable to reach it. So, I was using the http site url for connections but I remembered we enabled https in the server recently as part of an upgrade to 10.7.1. The server's certificate was invalid, once we solved that we were able to publish successfully to that server. I also had to register the SQL Server database in the server for it to work because we had changed the IPs recently (in Registered Databases)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Apr 2020 12:22:53 GMT</pubDate>
    <dc:creator>MauricioCastro</dc:creator>
    <dc:date>2020-04-21T12:22:53Z</dc:date>
    <item>
      <title>ArcCatalog(10.5.1)/ArcGIS Server (10.6.1) crash when running arcpy script</title>
      <link>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165606#M12717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;I created a standalone arcpy script which I then converted to a Python toolbox with the intention of publishing it as a geoprocesssing service. The script runs fine when run standalone (i.e. python scriptname.pyt). However, when I run it using ArcCatalog (10.5.1) it crashes ArcCatalog. It seems to crash at the point of exiting a function. I then tried deploying it to ArcGIS Server (10.6.1). I find that it sill crashes on this newer version of server. I have found that the problem seems to be caused by a call to the arcpy.mapping.CreateMapSDDraft method. The method works ok but as stated earlier this causes the calling function to crash on exit. &amp;nbsp;Here is the code snippet that causes the problem&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sddraft = os.path.join(wrkspc, servicename + '.sddraft')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newSDdraft = os.path.join(wrkspc, servicename + 'updated.sddraft')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sd = os.path.join(wrkspc, servicename + '.sd')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Save layers to a new map document (mxd file)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(inputmxd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr = arcpy.SpatialReference("British National Grid")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeQueryLayer_management(dbConnectionFile, featuresToPublish, "select " + columnList + " from " + featuresToPublish, "Geometry_ObjectId", 'Point', 27700, sr)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SaveToLayerFile_management(featuresToPublish, layerfile, "ABSOLUTE")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;self.messages.addMessage("Saved to layer file")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addLayer = arcpy.mapping.Layer(layerfile)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addLayer.name = servicename&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.saveACopy(outputmxd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd, df, addLayer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapDoc = arcpy.mapping.MapDocument(outputmxd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.messages.addMessage("Saved map layer to new mxd file")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create draft service definition file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # &lt;STRONG&gt;This causes the calling function to crash on exit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, servicename, 'ARCGIS_SERVER', &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serverConnectionFile, False, None, summary, tags)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del mapDoc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Further code to stage and publish the feature service – commenting out makes no difference to the crash&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;Can anyone give any ideas on what might be causing the problem and how to fix/work around it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; color: #0f243e;"&gt;Harsha&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2019 17:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165606#M12717</guid>
      <dc:creator>HarshaPerera</dc:creator>
      <dc:date>2019-01-10T17:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: ArcCatalog(10.5.1)/ArcGIS Server (10.6.1) crash when running arcpy script</title>
      <link>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165607#M12718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've had similar problem with a python script published as a &lt;SPAN style="color: #0f243e; background-color: #ffffff;"&gt;geoprocesssing service&lt;/SPAN&gt;&amp;nbsp;to ArcGIS Server 10.6. It runs fine as a standalone script or from a tool within Pro. However, the use of the LayerFile is causing my GP service to crash on Server.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2020 01:37:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165607#M12718</guid>
      <dc:creator>TimGunn</dc:creator>
      <dc:date>2020-03-26T01:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: ArcCatalog(10.5.1)/ArcGIS Server (10.6.1) crash when running arcpy script</title>
      <link>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165608#M12719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had the same problem, the symptoms were #1 it weren't reaching further code after using the connection file to the arcgis server (like the&amp;nbsp;&lt;SPAN style="color: #0f243e; background-color: #ffffff;"&gt;CreateMapSDDraft or the UploadServiceDefinition_server calls) so I came to the conclusion something was wrong in the server connection file. #2 the connection files worked fine in Arcmap which was really confusing, then I noticed it worked there but was asking to accept and invalid server certificate. #3 No logs were added to the ArcGIS server, like Arcpy was unable to reach it. So, I was using the http site url for connections but I remembered we enabled https in the server recently as part of an upgrade to 10.7.1. The server's certificate was invalid, once we solved that we were able to publish successfully to that server. I also had to register the SQL Server database in the server for it to work because we had changed the IPs recently (in Registered Databases)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2020 12:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arccatalog-10-5-1-arcgis-server-10-6-1-crash-when/m-p/165608#M12719</guid>
      <dc:creator>MauricioCastro</dc:creator>
      <dc:date>2020-04-21T12:22:53Z</dc:date>
    </item>
  </channel>
</rss>

