<?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: Debug python script under arcmap in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58113#M4581</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the first response is here for PythonWin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Executing_and_debugging_Python/002100000022000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Executing_and_debugging_Python/002100000022000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but with VS2010 ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Nov 2012 11:38:28 GMT</pubDate>
    <dc:creator>PhilippeSTEINMANN</dc:creator>
    <dc:date>2012-11-19T11:38:28Z</dc:date>
    <item>
      <title>Debug python script under arcmap</title>
      <link>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58112#M4580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run my Python script in ArcMap from my toolbox, I would start debugging ... how?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use PythonWin and also Python Tools for VS2010;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried in VS2010 the command 'attach to process' but it does not work ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do you do?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you very much&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 11:29:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58112#M4580</guid>
      <dc:creator>PhilippeSTEINMANN</dc:creator>
      <dc:date>2012-11-19T11:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Debug python script under arcmap</title>
      <link>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58113#M4581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the first response is here for PythonWin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Executing_and_debugging_Python/002100000022000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Executing_and_debugging_Python/002100000022000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but with VS2010 ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 11:38:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58113#M4581</guid>
      <dc:creator>PhilippeSTEINMANN</dc:creator>
      <dc:date>2012-11-19T11:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Debug python script under arcmap</title>
      <link>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58114#M4582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;it's the same road in VS2010 .... in options in Projet&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 12:42:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58114#M4582</guid>
      <dc:creator>PhilippeSTEINMANN</dc:creator>
      <dc:date>2012-11-19T12:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Debug python script under arcmap</title>
      <link>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58115#M4583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this will help, but here is a function I found (I think in these forums somewhere, apologies to the original contributor). Isn't as nice as being able to step through, but (usually) gives the offending line's number in the results dialog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;### Geoprocessing script traceback error info ###
import os, sys, traceback
def trace():
 tb = sys.exc_info()[2]
 tbinfo = traceback.format_tb(tb)[0] # script name + line number
 line = tbinfo.split(", ")[1]
 
 # Construct the pathname to this script.&amp;nbsp; Get the pathname
 #&amp;nbsp; to the folder containing the script using sys.path[0].
 #&amp;nbsp; Modify line below and replace 'myscript.py' with the name of
 #&amp;nbsp; this script.
 
 filename = sys.path[0] + os.sep + "ScriptFileName.py" #&amp;lt;--- Insert filename
 
 # Get Python syntax error
 synerror = traceback.format_exc().splitlines()[-1]
 return line, filename, synerror
 
## Try-Except clause format:
# try:
# your code here
# except arcpy.ExecuteError:
 # for msg in range(0, arcpy.GetMessageCount()):
&amp;nbsp; # if arcpy.GetSeverity(msg) == 2:
&amp;nbsp;&amp;nbsp; # arcpy.AddReturnMessage(msg)
# except:
 # line, filename, err = trace()
 # arcpy.AddError("Python error on " + line + " of " + filename)
 # arcpy.AddError(err)
 # print "Python error on " + line + " of " + filename
 # print err&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:12:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debug-python-script-under-arcmap/m-p/58115#M4583</guid>
      <dc:creator>MattSayler__Work_</dc:creator>
      <dc:date>2021-12-10T22:12:10Z</dc:date>
    </item>
  </channel>
</rss>

