In this module, the use of the Python Window that is contained within Esri ArcMap Desktop will be covered. It is assumed that the learner is using version 10.1 or higher of the software. The author constructed this lesson-using version 10.3 and higher of Esri ArcMap. The interfaces for the older version should look similar.
The Python window is a smart immediate mode editor, which allows for saving information. Thus on the pressing of Enter or Return, the script line will execute. When a colon is the last character of functional code it does not execute the code until the loop is completed. Loops and decision scripts will be executed by pressing Enter twice on the keyboard.
The Python window is a smart immediate mode editor, which allows for saving information. Thus on the pressing of Enter or Return, the script line will execute. When a colon is the last character of functional code it does not execute the code until the loop is completed. Loops and decision scripts will be executed by pressing Enter twice on the keyboard.
Functions
- Use of the ArcMap Python Window
- Buffering
- Merging
- Spatial reference (determination)
- GetCount
- List functions
Getting Started
The Python Window is similar to an IDE, but it is not required that arcpy be loaded since the operation is being done within ArcMap and by default, it is already loaded. There are no issues with the script if it contains loading statements for arcpy. Generally retaining those lines of code makes the scripts more universal in how they function. Therefore, these scripts will also run outside of the ArcMap environment.
Code is saved by right clicking in the window and selecting save. Loading code works in the same general way. Care must be taken in the saving of code since whatever is visible in the Python Window will be saved which could include errors. It is generally not recommend saving the code from this Window, but loading the code into this window can be useful.
To understand how the Python Window functions, the first example will use code that was covered earlier in the course. In this way, the learner can explore the similarities and the differences. As the code is typed in, the Python window suggestions are made to the formatting of the tool/command, which can save time in the input steps. All code covered in this module could also work directly in an IDE, copy and paste functions can be used as well.
Code is saved by right clicking in the window and selecting save. Loading code works in the same general way. Care must be taken in the saving of code since whatever is visible in the Python Window will be saved which could include errors. It is generally not recommend saving the code from this Window, but loading the code into this window can be useful.
To understand how the Python Window functions, the first example will use code that was covered earlier in the course. In this way, the learner can explore the similarities and the differences. As the code is typed in, the Python window suggestions are made to the formatting of the tool/command, which can save time in the input steps. All code covered in this module could also work directly in an IDE, copy and paste functions can be used as well.