TypeError: GPToolDialog() takes at most 1 argument (2 given)

6478
21
08-04-2014 11:00 AM
SurendranNeelakantan
New Contributor III

I am using ArcGIS 10.22

An error  is coming in the python window  "TypeError: GPToolDialog() takes at most 1 argument (2 given)"

But the tool seems working fine

The  documentation says : GPToolDialog(toolbox, tool_name)

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Does anyone know the  reason ?

 

Thanks

0 Kudos
21 Replies
JasonScheirer
Occasional Contributor III

Is the tool dialog showing up? If not, are you sure you're passing in the correct path to the TBX and the correct Tool Name?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Is it in the format of the last line of that help?

pythonaddins.GPToolDialog(r'C:\MyTools\WaterStudy.tbx', 'GroundWaterYield'

note the raw notation to the tbx name.

0 Kudos
SurendranNeelakantan
New Contributor III

Jason & Dan

Thanks for the reply

Yes Tool Dialog is showing up and executing .

I am using the  following line

pythonaddins.GPToolDialog(toolboxPath, toolName)

Where toolbox path and toolbox name are variable pointing to the correct path.

My question is  Why the error says  "at most 1 argument"  where it supports  2 arguments.

thank you

0 Kudos
DanPatterson_Retired
MVP Emeritus

No clue...other people haven't reported errors

https://community.esri.com/message/392058?sr=search&searchId=4b22ed49-a83c-4de1-be96-7e8db45afe9c&se...

show us the path and toolbox name...however, I doubt that is the problem since you said the tool operates.

What version are you using?  I can find no bugs listed except for version 10.2.2 being modal

0 Kudos
SurendranNeelakantan
New Contributor III

Dan

I am using 10.22

Here is the  code to call the Dialog

import arcpy

import pythonaddins

import os.path

class ButtonBuildGDB(object):

    def __init__(self):

        self.enabled = True

        self.checked = False

    def onClick(self):

        toolboxName = "GDBAutomation_DRAFT"

        toolName = "BuildGDB"

        toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".pyt")

        pythonaddins.GPToolDialog(toolboxPath, toolName)

Thanks

0 Kudos
KenBuja
MVP Esteemed Contributor

Does the toolboxPath variable contain any spaces?

0 Kudos
SurendranNeelakantan
New Contributor III

Ken

There is no spaces in the toolboxPath variable

Thanks

Surendran

0 Kudos
DanPatterson_Retired
MVP Emeritus

From the thread I posted, I notice that they are using a toolbox (ie *.tbx)

toolPath = relPath + r"\Custom Tools\Get IR Count\Install\GetIR.tbx"

and you are using a python toolbox

toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".pyt")

could that be the difference?  You might be advised to consult the section on python toolboxes again since their behaviours differ in some respects.

0 Kudos
SurendranNeelakantan
New Contributor III

Dan

I am not sure  if the python toolbox  is the problem.   I am  calling   tool from a python toolbox . Tool works fine from  tool bar button. The above error message is only visible if python window is open in Arcmap.  This error not preventing the tool execution. May be I can Ignore this.

Thank you

0 Kudos