<?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: pythonw.exe crashing in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725755#M56237</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Solved this by creating an entirely new mxd. The original was not "corrupt" but there was something causing an issue. Thanks for the help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 May 2013 18:55:25 GMT</pubDate>
    <dc:creator>MarcCusumano</dc:creator>
    <dc:date>2013-05-08T18:55:25Z</dc:date>
    <item>
      <title>pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725748#M56230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had some code working previously that is now causing pythonw.exe to crash. I have an .mxd set up that I am using to loop through features in a layer and export the layout to jpeg. However now the script crashes when it gets to df.zoomtoselectedfeatures. Here is what I have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; Path = os.getcwd() GSP_Join = "C:\\Users\\TDMC0\\AppData\\Local\\Temp\\scratch.gdb\\GSP_Join"&amp;nbsp; mxd = arcpy.mapping.MapDocument(Path + r"\GasLeaks2013.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] Layer = arcpy.mapping.ListLayers(mxd, "", df)[0] Layer2 = arcpy.mapping.ListLayers(mxd, "", df)[1] Layer3 = arcpy.mapping.ListLayers(mxd, "", df)[2]&amp;nbsp; # Create a search cursor try: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(GSP_Join, "", "", "CONN_OBJ_ID_NUM", "CONN_OBJ_ID_NUM")&amp;nbsp; except Exception as e: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print e&amp;nbsp; # Iterate through the Implausible Reads Feature, getting and zooming to respective extents and exporting layout to JPEG. currentState = " " count = arcpy.GetCount_management(GSP_Join) progress = 1&amp;nbsp; for row in rows:&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&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; if currentState != row.CONN_OBJ_ID_NUM: &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; print "\rExporting Data Driven Pages to JPEG...%s of %s" %(progress, count) &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; currentState = row.CONN_OBJ_ID_NUM &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; where_clause = "\"CONN_OBJ_ID_NUM\"=" + "'" + currentState + "'" &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; arcpy.SelectLayerByAttribute_management(Layer, "NEW_SELECTION",&amp;nbsp; where_clause) &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; df.zoomToSelectedFeatures() &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; df.scale = 5500 &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; arcpy.RefreshActiveView() &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; arcpy.SelectLayerByAttribute_management (Layer, "CLEAR_SELECTION", "") &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; Layer.definitionQuery = where_clause &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; Layer2.definitionQuery = where_clause &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; Layer3.definitionQuery = where_clause &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; arcpy.mapping.ExportToJPEG(mxd, r"E:\GasLeaksProject\2012\JPEG\CONN_OBJ_ID_NUM" + str(currentState) + ".jpeg", resolution=300, jpeg_quality=70) &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; Layer.definitionQuery = "" &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; Layer2.definitionQuery = "" &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; Layer3.definitionQuery = "" &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; progress = progress + 1 &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; except Exception as e: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print e&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run this I get a Windows OS message saying "pythonw.exe has crashed". I narrowed it down to the line df.zoomToSelectedFeatures() (if I comment out this line the code runs but obviously does not output what I want). Again this was working previously (about six months ago) I must have tested it a hundred times. All of the data sources are working in the mxd, and I tried re-saving the mxd and pointing to the new copy but no luck. I also printed my where_clause and it looks good. It must be a problem with my "list data frames / list layers code". Any help would be appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 13:28:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725748#M56230</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-04-30T13:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725749#M56231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since you are going through a cursor anyway you can just get the extent of the row shape object instead of using a selection. Unless there is some particular reason you need to select it. I'm also assuming your selections are unique to each row since you call them CONN_OBJ_ID_NUM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = row.Shape.extent&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:01:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725749#M56231</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-12T07:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725750#M56232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So pythonw.exe is still crashing, I don't think it has anything to do with what I previously thought. I I comment that out, it will get through 14 or so images and then crash. Can anyone see anything wrong with my code / how to optimize it? Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 12:37:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725750#M56232</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-05-01T12:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725751#M56233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you watch the process and related threads does it get over 2GB? Do you have any AV program running?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 12:45:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725751#M56233</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-05-01T12:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725752#M56234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found out that I cannot even pan to the features in the map document. The rest of the script - the part before the loop that exports the jpeg images - performs spatial selections and queries against point features to detect clusters of gas leaks and writes them to a gdb. The layers in the saved map document point to these new features. When I try to pan to the 24th record it crashes ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 14:32:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725752#M56234</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-05-01T14:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725753#M56235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there something wonkey with the 24th feature in your GSP_Join layer (null/corupt geometry)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you do it manually and have it work correctly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 15:11:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725753#M56235</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-05-01T15:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725754#M56236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm currently testing the process on separate machines - one running 10.0 and my main workstation running 10.1. I'll let you know what I find.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 16:31:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725754#M56236</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-05-01T16:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: pythonw.exe crashing</title>
      <link>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725755#M56237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Solved this by creating an entirely new mxd. The original was not "corrupt" but there was something causing an issue. Thanks for the help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 18:55:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pythonw-exe-crashing/m-p/725755#M56237</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-05-08T18:55:25Z</dc:date>
    </item>
  </channel>
</rss>

