CheckOutExtension (arcpy)

摘要

Retrieves the license from the License Manager.

脚本检索到扩展模块许可后,即可使用扩展模块工具。脚本使用完扩展模块中的工具后,应使用 CheckInExtension 函数将许可归还给许可管理器,以便其他应用程序使用。当脚本完成时,所有检出的扩展模块许可和设置的产品许可都将归还给许可管理器。

讨论

提示提示:

只有在独立脚本中才必须设置产品和扩展模块。如果从 Python 窗口运行工具或者使用脚本工具,产品已在应用程序内进行设置,激活的扩展模块取决于“扩展模块”对话框。

语法

CheckOutExtension (extension_code)
参数说明数据类型
extension_code

Keyword for the extension product that is being checked.

  • 3D3D Analyst
  • SchematicsArcGIS Schematics
  • ArcScanArcScan
  • BusinessBusiness Analyst
  • DataInteroperabilityData Interoperability
  • GeoStatsGeostatistical Analyst
  • JTX Workflow Manager
  • NetworkNetwork Analyst
  • AeronauticalEsri Aeronautical Solution
  • DefenseEsri Defense Solution
  • FoundationEsri Production Mapping
  • DatareviewerArcGIS Data Reviewer
  • NauticalEsri Nautical Solution
  • NauticalbEsri Bathymetry
  • SpatialSpatial Analyst
  • StreetMapStreetMap
  • TrackingTracking
String
返回值
数据类型说明
String

There are three possible returned values for CheckOutExtension:

  • NotInitializedNo desktop license has been set.
  • UnavailableThe requested license is unavailable to be set.
  • CheckedOutThe license has been set successfully.

代码实例

CheckOutExtension example

Check out 3D extension for use by tools.

class LicenseError(Exception):
    pass

import arcview
import arcpy
from arcpy import env

try:
    if arcpy.CheckExtension("3D") == "Available":
        arcpy.CheckOutExtension("3D")
    else:
        # raise a custom exception
        #
        raise LicenseError

    env.workspace = "D:/GrosMorne"
    arcpy.HillShade_3d("WesternBrook", "wbrook_hill", 300)
    arcpy.Aspect_3d("WesternBrook", "wbrook_aspect")
    arcpy.CheckInExtension("3D")

except LicenseError:
    print "3D Analyst license is unavailable"
except:
    print arcpy.GetMessages(2)

相关主题

9/15/2013