According to these links, one can debug a Python script using Visual Studio in ArcGIS Pro. Debug Python code—ArcPy Get Started | ArcGIS Desktop

ArcGIS Pro and Python - YouTube

I am using ArcGIS pro version 2.3 and Visual studio 2017. My steps

  1. Downloaded the 'Python development' workload to visual studio Pro 2017.
  2. Edited my .py file to add some intentional errors for testing.
  3. Opened ArcGIS Pro with my tool and my data to be run.
  4. Opened my .py file in Visual Studio and added some breakpoints.
  5. Attached to process in Visual Studio. See image below:

enter image description here

  1. Ran my script tool in ArcGIS Pro.

The tool fails in ArcGIS Pro because it has errors but I am not re routed to Visual Studio to see the error line as I expected. I then removed the errors in the code and left only the breakpoints but I still wasn't able to hit the breakpoints. Again, the tool completed without re-routing me back to visual studio. Has anyone been able to successfully debug Python tools using Visual Studio Pro 2017 in ArcGIS Pro?

  • I've never gotten "debug arcpy in XYZ" to work in anything other the standard python interpreter and ipython – Paul H Mar 13 '19 at 20:31
  • The top link suggests not to connect to ArcGISPro but connect to a Python instance. – klewis Mar 13 '19 at 20:44
  • @klewis The link does say to attach visual studio to ArcGIS Pro. It says to attach to 'python code' in visual studio as I did in the image I posted in the original question. – ketar Mar 13 '19 at 20:48
  • @PaulH, Esri has demo videos where they get it to work so I figured it's possible. – ketar Mar 13 '19 at 20:50
  • I have VS 2017 and I can debug from ArcPro. Open your script in VS, set a breakpoint, attach to Pro, run the script tool from Pro, it should stop at the breakpoint. I have to reattach to ArcPro every time for some reason. – klewis Mar 13 '19 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.