Use PyScripter to Edit ArcGIS Python Scripts

It is possible to set up any text editor to be the default editor in ArcGIS. This way, when choosing Edit from the context menu, your code editor of choice appears for you to edit your script.

Personally, my preference is to use PyScripter, an open source Python IDE. It provides code highlighting and dynamically reads imported libraries to provide a simple code assist. PyScripter also has an interactive Python dialog to test snippets of code while putting together larger scripts.

PyScripter is a free and open source project hosted and available from Google Code. When downloading, pay attention to which version you are downloading. There are both 32 and 64 bit versions. If you are using Windows XP or another 32 bit version of Windows, you will want the download titled PyScripter-v2.5.3-Setup.exe. If on Windows 7 or another 64 bit version of Windows, you will want the download titled PyScripter-v2.5.3-x64-Setup.exe.

There is also a standalone executable available, titledĀ PyScripter-v2.5.3.zip. This can be useful for a portable solution, but might be slightly less useful if you want to set up a default Python script editor in ArcGIS. As a result, I recommend against using this option for what we are trying to accomplish in this blog post.

Geoprocessing Menu

Setting up ArcGIS to use PyScripter as the code editor is easily accomplished in the Geoprocessing Options dialog. This dialog is accessed by going to Geoprocessing > Geoprocessing Options.

Geoprocessing Options Dialog

In the Geoprocessing Options dialog, look for the Script Tool Editor/Debugger section. Here, specify the application you want to use for editing and debugging (obviously). If you are planning on using PyScripter the path you will want to browse or type into these fields is C:Program FilesPyScripterPyScripter.exe

Now your default script editor can be accessed through the context menu for any script. Right click on the script to access the context menu and select Edit.

Edit Script Context MenuBy setting a single geoprocessing property you can access a much more user friendly code editing environment. Although I prefer and use PyScripter, you can use any IDE you like. Many of my colleagues prefer Notepad++. It really does not matter. Whatever your preference, you can use it by configuring this simple setting.