Appendix A. Automating Python Scripts

In this chapter, we will cover the following recipes:

  • Running Python scripts from the command line
  • Using sys.argv[] to capture command-line input
  • Adding Python scripts to batch files
  • Scheduling batch files to run at prescribed times

Introduction

Python geoprocessing scripts can be executed either outside ArcGIS as a standalone script or inside ArcGIS as a script tool. Both methods have their advantages and disadvantages. Up to this point in the book, all our scripts have been run either inside ArcGIS as a script tool, or from a Python development environment such as IDLE, or the Python Window in ArcGIS. However, Python scripts can also be executed from the Windows operating system command line. The command line ...

Get Programming ArcGIS 10.1 with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.