PythonWin + ArcGIS not playing well together.

Discussion created by lgtateos on Jan 17, 2012
Latest reply on Apr 3, 2013 by sdoherty82
Is anyone else having problems with PythonWin running geoprocessing commands?  Pythonwin intermittently crashes on arcpy.env.workspace, arcpy.Buffer, or other tools.  Has anyone solved this issue yet? Here's a video to show you what I mean:


In the video, closing PythonWin between each test:
test 1: run script (with running man) -- it crashes
test 2: run script with step through -- it works
test 3: run script with running man -- it works
test 4: comment out setting workspace in script.  run script (with running man) -- it crashes
test 5: workspace still commented out, try our fix in the interactive window -- it crashes when setting workspace
test 6: try same thing -- it crashes
test 7 : try with capital T,  -- it crashes
test 8:  run script with running man -- it crashes
test 9: run script with step over -- it crashes
test 10: add line of code setting workspace back into script.  Run it -- it crashes. (though the vid stops just before this)

I know there are alternatives to Pythonwin.  But I'd really rather solve this problem then march off to a different editor.  I know this stuff can be run at the Python command prompt inside Arc, but that doesn't have the debugging facilities of PythonWin.  IDLE also doesn't have the nice debugging interface of PythonWin.


Here's the code I used in the video. (Though there's nothing wrong with the code itself.)  If anyone would be kind enough to try this out, you can replace the line of code that points to my shapefile with one of your own, and it should work with no arguments.  (input = "C:\\Temp\\COVER63p.shp" )
# ---------------------------------------------------------------------------
# exported2.py
# Created on: 2012-01-10 12:52:28.00000
#   (generated by ArcGIS/ModelBuilder)
# Usage: exported2 <distance> <input> <output> 
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy
arcpy.env.overwriteOutput = 1
arcpy.env.workspace = "C:/Temp"
# Script arguments
distance = arcpy.GetParameterAsText(0)
if distance == '#' or not distance:
    distance = "5 Feet" # provide a default value if unspecified

input = arcpy.GetParameterAsText(1)
if input == '#' or not input:
    input = "C:\\Temp\\COVER63p.shp" # provide a default value if unspecified

output = arcpy.GetParameterAsText(2)
if output == '#' or not output:
    output = "C:\\Temp\\abc.shp" # provide a default value if unspecified

# Process: Buffer
arcpy.Buffer_analysis(input, output, distance)

print arcpy.GetMessages()