• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

控制 Python 工具箱中的许可行为

def isLicensed(self):
    """Allow the tool to execute, only if the ArcGIS 3D Analyst 扩展模块 
    is available."""
    try:
        if arcpy.CheckExtension("3D") == "Available":
            raise Exception
    except Exception:
        return False # tool cannot be executed

    return True # tool can be executed

isLicensed 方法是一种可选方法,用于检查 Python 工具箱中的工具是否具有执行许可。如果运行其他地理处理工具(由 Python 工具箱中的工具使用)所需的相应许可和扩展模块不可用,那么可使用该方法限制工具的运行。

如果 isLicensed 方法返回 False,则工具不能执行。如果该方法返回 True 或未使用该方法,则工具可以执行。

posted on 2019-08-17 12:27  gisai  阅读(357)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3