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 for 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

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Listing tools, toolboxes, and environment settings

Depending on which toolboxes are available, ArcPy might have access to several toolboxes, dozens of environment settings, and hundreds of tools. ArcPy has several appropriately named functions to return a list of tools (ListTools), environment settings (ListEnvironments), or toolboxes (ListToolboxes).

Each function has a wild card option and returns a list of name strings that can be looped through. The example below shows how to access available tools and print out their usage.

import arcpy

# Create a list of the conversion tools
#
tools = arcpy.ListTools("*_conversion")

# Loop through the list and print each tool's usage
#
for tool in tools:
    print(arcpy.Usage(tool))

The following sample provides an approach for viewing environment settings in Python.

import arcpy

environments = arcpy.ListEnvironments()

# Sort the environment list, disregarding capitalization
#
environments.sort(key=str.lower)

for environment in environments:
    # As the environment is passed as a variable, use Python's getattr 
    #   to evaluate the environment's value
    #
    env_value = getattr(arcpy.env, environment)

    # Format and print each environment and its current setting
    #
    print("{0:<30}: {1}".format(environment, env_value))

The following sample provides an approach for viewing current toolboxes in Python.

import arcpy 

# Print all current toolboxes
#   
for toolbox in arcpy.ListToolboxes():
    # Toolboxes are printed in the form of "toolbox_name(toolbox_alias)"
    print(toolbox)

Related topics

  • Create lists of data

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

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