首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:“模块”对象没有属性(ArcMap 10.1)

错误:“模块”对象没有属性(ArcMap 10.1)
EN

Stack Overflow用户
提问于 2014-04-25 07:25:46
回答 1查看 1.4K关注 0票数 0

我是使用Python创建Python工具箱的初学者。我试图按照这个视频http://www.youtube.com/watch?v=B6zbzPOnYYQ中的说明创建我的第一个Python,我尝试使用视频中的代码创建这个工具箱(从24:00到27:00)。但是,在编写了精确的代码并试图运行它之后,我得到了这个错误;

代码语言:javascript
复制
Traceback (most recent call last):  File "<string>", line 24,
  in getParameterInfoAttributeError: 'module' object has no attribute 'Paramter' 

代码如下所示

代码语言:javascript
复制
import arcpy

class Toolbox(object):
    def __init__(self):
        """Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""
        self.label = "Calculate Geomtery"
        self.alias = "Geometry"

        # List of tool classes associated with this toolbox
        self.tools = [CalculateGeometry]


class CalculateGeometry(object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Calculate Geometry"
        self.description = ""
        self.canRunInBackground = True

    def getParameterInfo(self):
        # First parameter
    in_features = arcpy.Paramter(
        displayName="Input Features",
        name="in_features",
        datatype="Feature Layer",
        parameterType="Required",
        direction="Input")
    in_features.filter.list = ["Point", "Polyline", "Polygon"]

        # Second parameter
    field = arcpy.Paramter(
        displayName="Field Name",
        name="field_name",
        datatype="Field",
        parameterType="Required",
        direction="Input")

    field.parameterDependencies = [in_features.name]
    in_features.filter.list = ["Short", "Long", "Double", "Float", "Text"]

    # Third parameter
    geomProperty = arcpy.Paramter(
        displayName="Property",
        name="geomProperty",
        datatype="String",
        parameterType="Required",
        direction="Input")

    # Fourth parameter
    units = arcpy.Paramter(
        displayName="Units",
        name="units",
        datatype="String",
        parameterType="Optional",
        direction="Input",
        enabled=False)

    # Fifth parameter
    out_features = arcpy.Paramter(
        displayName="Output Features",
        name="out_features",
        datatype="Feature Layer",
        parameterType="Derived",
        direction="Output")

    out_features.parameterDependencies = [in_features.name]
    out_features.schema.clone = True

    params = [in_features, field, geomProperty, units, out_features]
    return params

    def isLicensed(self):
        """Set whether tool is licensed to execute."""
        return True

    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""
        return

    def updateMessages(self, parameters):
        """Modify the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""
        return

    def execute(self, parameters, messages):
        """The source code of the tool."""
        return

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-25 08:05:40

根据你的错误信息和文档,我认为你拼错了这个单词。

应该是:arcpy.Parameter(parameters)

对不起,我本可以留下评论的,但是没有足够的声誉。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23286716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档