I want to write scripts in IDLE, but I love how the built in python window in ArcGIS 10.2 automatically fills in the module names as you start typing them.

For example, if I type arcpy.Lis..., the python window in ArcGIS will suggest arcpy.ListDataStoreItems.

In IDLE, that doesn't occur, and I feel that if I type one wrong letter or mess up a case, it will cause the script to crash and burn.

At the top of my script, I write:

import arcpy.mapping as mapping
# etc

However I don't believe this runs until the script runs, so how can the window know what I've imported. Can I do something in the shell so that the autocomplete works in IDLE?

migrated from stackoverflow.com Nov 4 '13 at 0:09

This question came from our site for professional and enthusiast programmers.


Once you've imported arcpy you can go to the IDLE menu bar and click Edit>Show Completions. This will activate autocomplete for arcpy scripts. This can also be activated with the keyboard shortcut CTL + space. Once you type an open parenthesis IDLE will display the syntax for the arcpy class, just like in the python window in ArcGIS.

  • 2
    I think there is one extra step you may want to include in your Answer, which is that until you have run the import arcpy line within IDLE it will not have access to the arcpy site-package to enable auto-completion of ArcPy code. I now routinely do this as my first step of writing a new ArcPy script in IDLE. – PolyGeo Mar 10 '14 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.