Installing PyScripterIt's important to start out with a clean install of Python. I tried to install PyScripter with multiple versions of Python on my office computer and the result was a frustrating hour trying (and failing) to get PyScripter to talk to ArcPy. If you need multiple versions of Python, I wish you luck. Please let me know if there's a secret I missed.
If you have only installed ArcGIS 10.2 (Python 2.7.3 comes as part of that installation) you can skip the first step.
- Uninstall all versions of Python from your computer. You will then need to repair your ArcGIS 10.2 installation to reinstall the ArcGIS-flavored Python.
- Download PyScripter (
- Either version (32-bit or 64-bit) should work on most machines. If you're unsure which version you need, go with the x86 version.
- There is a stand alone version of PyScripter that you can install on a flash drive or external hard drive. To get that version talking to ArcPy visit Map Guy Mike's tutorial
- After the install check the Python paths for ArcPy
- Navigate to c:\python27\Lib\site-packages
- Find the Desktop10.2.pth file-you'll need to view/edit this file with Notepad
- This file should contain the right information, feel free to skip this step and come back to it if ArcPy doesn't work.
- There should be three line in the file:
c:\Program Files\ArcGIS\Desktop10.2\arcpy c:\Program Files\ArcGIS\Desktop10.2\bin c:\Program Files\ArcGIS\Desktop10.2\ArcToolbox\Scripts
- If you need to, add these lines, save and close the file. If these lines are in there, you are good to go.
- Fire up PyScripter (in the Start menu, choose PyScripter (Latest Python Version))
PyScripter SetupOnly one small thing to do here...Go to the Tools menu, then Options > IDE Options. Under special packages add arcpy to the end of the list.
Test it outIn the bottom Interpreter (command line) window try import arcpy hit enter (maybe twice) and see if it works.
A Quick TourThe upper window in PyScripter is the Editor window-this is where you will write your stand alone code. The auto-complete works in here as long as you have your module import statements at the top (which you should anyway).
** As a bonus, you don't have to save your scripts before you run them. BUT, be sure that you do save them at some point.
The bottom window is the Interpreter (command line) window. This is like the main IDLE window, where you can test individual code bits and where some messages will appear.
Along the bottom are some tabs for advanced code editing and debugging. One of my favorites is the Variables tab. This is where you can see what variables are in memory and what their values are. This will be important as we start to build larger scripts and need to start debugging them.