ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Customizing the Python window

  • Python window context menu

The Python window recognizes the system environment variable PYTHONSTARTUP. If PYTHONSTARTUP has been previously set to a Python file, Python will automatically execute that file's code when the Python window is opened. This is a useful way to ensure that your Python window experience starts with all your commonly used Python utilities preloaded.

To add the PYTHONSTARTUP environment setting, do the following:

  1. Right-click My Computer and click Properties.
  2. Click the Advanced tab and click Environment Variables.
  3. Under System variables, click New.
  4. Add PYTHONSTARTUP to Variable name.
  5. Add the path of the Python file to Variable value and click OK.
  6. Click OK.

Below is one possible startup file. If PYTHONPATH has been set to this startup file, when you open the Python window, arcpy, numpy, and time will already be imported, and the overwriteOutput setting will be turned on.

# My startup file 
import arcpy 
from arcpy import env
import numpy 
import time 
env.overwriteOutput = True

Python window context menu

Right-click in the Python window or the Python window help and syntax pane to view the context menu for that section.

Python window context menu

Show Default Choices

When checked, code completion will provide available options.

Add To Results

When checked, tools executed in the Python window will be added to the Results window.

Load

Load an existing Python file.

Save As

Save Python window contents to a Python or text file.

Help Placement

This describes where the Help pane will be placed, relative to the main prompt.

Format

Change Python window theme and character fonts and colors.

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal