How do you debug a script tool in ArcGIS Pro 2.0.1?

1251
8
Jump to solution
10-10-2017 06:56 AM
DuncanHornby
MVP Frequent Contributor

All,

In ArcMap you can create a script tool by wiring up an interface to an existing script. You can then run it, edit it or run it in debug mode using your favorite IDE.

In ArcGIS Pro 2.0.1 how to you run a script tool in debug mode? The help file just says you can but gives no other information. So when I right click on on a script in the tool box I do not see the option to run it in debug mode as shown below. Is it even possible?

Dan Patterson‌ put me onto using spyder IDE, so using the python package manager I installed spyder. I then went into the options and set the Script Editor to the spyder.exe. Now if I choose edit from the context menu it opens the script in spyder, so that bit works but how do I run it in debug mode so I can track down a bug? In ArcMap when you run a script in debug mode it allows you to set your parameters via the tool interface, then opens up the IDE and you can step through your code.

I'm assuming I've misunderstood something as this seems a major hole in doing any sort of scripting in ArcGIS Pro if you can't run it in debug mode?

I look forward to any advice!

Duncan

0 Kudos
1 Solution

Accepted Solutions
KoryKramer
Esri Community Moderator

Duncan, this is not yet built in to ArcGIS Pro.  There is an enhancement request [ENH-000096482: In ArcGIS Pro, include the ability to add a script debugger through Options > Geoprocessing] which has a status of In Product Plan but I don't think we'll see this in the Pro 2.1 release.  It will be coming in a future release.

View solution in original post

8 Replies
KoryKramer
Esri Community Moderator

Duncan, this is not yet built in to ArcGIS Pro.  There is an enhancement request [ENH-000096482: In ArcGIS Pro, include the ability to add a script debugger through Options > Geoprocessing] which has a status of In Product Plan but I don't think we'll see this in the Pro 2.1 release.  It will be coming in a future release.

DuncanHornby
MVP Frequent Contributor

Kory,

This explains why I could not find any evidence in Help, geonet, GIS SE or Google searches about debugging a script tool.

Very pleased to hear that this will be in a future release, the sooner the better!

I downloaded a toolbox from codesharing website and when I try to run it it simply crashes Pro. As I have some experience in python I thought I would run it in debug mode and see where it crashed as I would probably be able to nail the problem there and then before hassling the author of the tool. But ended up in a chicken and egg situation... So definitely need this to be implemented as soon as possible for us developers.

Duncan

KoryKramer
Esri Community Moderator

Hornbydd‌ Earlier you mentioned Spyder.  Also wondering if you currently use or have used PyCharm?  Please let me know.  The implementation of debugging will probably be different for ArcGIS Pro and I'm gathering info from users who debug scripts about what IDEs they're using.

Thank you!

DuncanHornby
MVP Frequent Contributor

Kory Kramer‌, well in ArcMap I have only ever used pyscripter (love it!) and have never needed to use any other IDE, ever. Whilst trying to run the ArcPro toolscript which I had downloaded from codesharing (love that too) I decided to debug it, but as you know failed because debug is not yet implemented. I only installed spyder because I was following a blog written by Dan Patterson and assumed that was where I had gone wrong, i.e. used the wrong IDE for ArcPro. But as you say, debug is not actually implemented in version 2.0.1. I have never used spyder and have no preference for it. If I could actually use pyscripter in ArcGIS Pro, I would use that out of preference as I know what I am doing with that IDE.

0 Kudos
KoryKramer
Esri Community Moderator

Perfect.  Thanks for the input.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Kory

For your survey.

Spyder works flawlessly in both map and pro and integrates seamlessly with numpy, scipy, matplotlib and a whole load of others.  It is highly customizable, and just plain nice with lots of useful bells and whistles and few useless ones...

Pycharm has largely been abandoned from what I can see from their last update date. 

PythonWin  (yes... old school) has seen some new life and I use it as an option when debugging scripts in 3.4/5/6/etc I think a pip install worked fine.  Also Jupyter QT console for quick command line stuff and Jupyter Notebook for developing quick and dirty teaching materials (if only GeoNet would enable running notebooks).

GabrielMarcus1
Occasional Contributor II

@KoryKramer sorry to bring to life this old post, but Is there a viewable list of enhancement requests? I was hoping the option to debug scripts would have been added to the Geoprocessing options tab, but I'm running 2.8.2 and I don't see it. 

I've searched the community site, esri support, Google, etc and this post is the only thing I can find that has "ENH-000096482".

Also, I downloaded the pro version of PyCharm and I'm having problems connecting it to the ArcGIS Pro process to debug. While there are numerous articles that cover the very basics about debugging scripts, I haven't seen anything that addresses this question. I've been able to debug scripts when I set the path to the project and run the script that way. Is this how it's done?

0 Kudos
KoryKramer
Esri Community Moderator

There isn't really information on that enhancement request as far as I can see on the support side - I think that there may be an effort underway to make enhancement requests available on support.esri.com, but that one you are citing only shows as 'non-reproducible' - presumably set to that when the debugging workflow as made possible in Pro.

Have you looked at https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/debugging-python-code.htm? 

0 Kudos