Specify Editor for Python Scripts in ArcGIS for Desktop

Python, it is extremely useful for streamlining workflows and SOP for a multitude of tasks. This is particularly true for geoprocessing in ArcGIS. True, ModelBuilder can be used. More often than not, I find myself starting in ModelBuilder and finishing in Python simply because of the ability to have more control over processes and the ease of using iteration.

ArcGIS for Desktop 10 introduced the option to embed scripts into tools. Once embedded, editing is as simple as right clicking on the script in a toolbox and selecting edit. The default Python IDE, IDLE would open and from there the script could be edited.

After installing ArcGIS for Desktop 10.1 Prerelease, I discovered when choosing to edit an embedded script, the script opened in Notepad. This was not acceptable. Fortunately setting the editor is an easy change.

To set the Python editor, from the Geoprocessing menu select Geoprocessing Options. In the Geoprocessing Options dialog, browse to the path where the desired editor executable file is located for Script Tool Editor/Debugger. For the Wing editor on my machine, the path is C:Program Files (x86)Wing IDE 101 4.1binwing-101.exe.

If you do not know the path to your Python editor, you can get it from the Windows Start Menu. The Start menu is nothing more than a collection of shortcuts to programs. You can get the location these shortcuts reference from the shortcut properties.

To find these paths, open the Start menu and right click on the program you prefer to use for script editing. Select properties and in the dialog select the Shortcut tab. In the shortcut tab, simply copy the target field. Use this path in ArcGIS as the location of both your script editor and debugger. With these properties set in ArcGIS for Desktop, you can seamlessly use any IDE you like for editing your scripts.

  • Holly Glaser

    In using ArcGIS with Wing IDE, following the process you described, I could run python code perfectly if it used no ArcGIS functions. In order to interpret arcpy functions, it is required to set the IDE external Extentions to the ARcGIS folder.

    • Joel

      Holly, this will be the case if you have multiple installations of Python on your computer. The Wing IDE will search for a default installation of Python, typically looking to the Windows path variable first. Since ArcGIS comes with it’s own build of Python, if Wing is first finding the default install of Python, you are entirely correct, it is not going to recognize anything ArcGIS uses since these extensions are not part of the path for the Python installation you are using.

      Take a look at where your Python path is pointing in Wing. If you are planning on developing with arcpy, it is going to need to be looking in C:\Python27\ArcGIS10.1\python.exe. Obviously if you have a different version of ArcGIS, the version number can be different, but otherwise the path will be the same.