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?
Answer
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.
If the above does not work, an extra step may be needed, which is that until you have run the import arcpy
line within IDLE once it will not have access to the arcpy site-package to enable auto-completion of ArcPy code.
No comments:
Post a Comment