Configuring PyScripter for writing Python scripts

PyScripter is a great Interactive Development Environment (IDE) for creating Python scripts as it provides an excellent environment for writing and debugging your code. This is the IDE which attendees to the “Introduction to Geoprocessing Scripts using Python” course use.


There are a couple of things which I get the class to do to configure PyScripter as these additional steps enhance the script writing experience within the course. This blog will lead you through these additional steps.

If you want to use PyScripter then you can access the source files from this location on GitHub, but if you do not have the time or the energy to compile the files then you can download the PyScripter installer from here. It is very easy to do and will take you no more than two minutes to complete. Links to the source files and the installer are provided at the end of this article.

Add Line Numbers

Line numbers should be made visible within your Python script if for no other reason than to aid the debugging process.

When a run-time error is generated a Traceback error is created. Amongst other things it lets you know which module your error occurred in, the type of error and the actual line of code which generated the error. Also included is the line number. I think you’ll agree it is easier searching for the line number when it is displayed than searching for a particular line of code.

To add line numbers to your module in PyScripter you should:

  • From the Tools menu choose Options > Editor Options
  • On the Display tab locate the Gutter section and tick the check box next to Show line number


  • Press the OK button to add line numbers to the left hand side of your script.


Remove the script border

if you use PyScripter then you may have noticed that on the right hand side of your script is a vertical line. This is used as a guide to suggest the maximum length for a line of code. This is easier said than done, especially when writing scripts which involve long workspace pathways or if you like adding comments at the end of a line of code.


So how can it be removed?

In the example above I could remove the hard-coded pathway and use arcpy.GetParamerterAsText() to pass the workspace value into the script.

I could also remove the line by quickly changing an option in PyScripter.

To do this you should:

  • From the Tools menu choose Options > Editor Options
  • On the Display tab locate the Right Edge
  • Whatever the value is for Edge Column change it to “0”.


  • Press the OK button and the border edge is no longer visible.

Initiating code completion for ArcPy

You may find that the intelligent code completion (AKA IntelliSense) for the arcpy site package is not always complete. In the example below notice that when arcpy.env is typed the overwriteOutput property is available, but very little else is presented in relation to the members of the env class.


It is fairly easy to ensure that you have full code completion for the arcpy site package, or for any third party / user defined module:

  • From the Tools menu, select Options > IDE Options
  • In the Code Completion region, of the IDE Options dialog, locate the Special packages
  • After the scipy entry add a comma and type arcpy as shown below:


  • Press the OK button to dismiss the dialog box and now when you retype env. you will now see the full code completion:


In a future post I will have a look at creating “script templates” which are handy if you find that you are writing the same “boiler-plate” code within your newly created scripts – but I will leave that Bijou for another time

Are there any other tips you have come across? If so then let everyone know about it by replying to blog and I will post your comments up!

Link to source files on GitHub:

Link to the PyScripter installer: