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
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?
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.
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
No clue...other people haven't reported errors
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
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
Does the toolboxPath variable contain any spaces?
Ken
There is no spaces in the toolboxPath variable
Thanks
Surendran
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.
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