The Error of "TypeError: GPToolDialog() takes at most 1 argument (2 given)"

905
18
01-02-2018 02:26 PM
fengchen1
New Contributor

Hello!

I try to click a button that I created in python add-in to execute a model (this model is made of the script tool), the button1 is ok, but when I click the button2 or button3 on the toolbar, it has an error as the title. Below are the pictures of my code and error. 

Fig.1 code

Fig.2 error (look at the black part of error dialog, this error dialog repeats almost 50 times!)

Looking for your reply, thank you so much.

0 Kudos
18 Replies
DanPatterson_Retired
MVP Esteemed Contributor

not sure I follow... your pythonaddins.gptooldialog does provide two parameters to it... how many are there supposed to be? the path to the toolbox filename? or the 'service area' or 'find_route' option?

0 Kudos
fengchen1
New Contributor

When I click button2 (the second button on the toolbar on figure 2), I want to execute "make service area" and button3 is about "find route". So could you please tell me how to revise the code to fulfile the function that I want. Thank you so much!

0 Kudos
RebeccaStrauch__GISP
MVP Esteemed Contributor

Re: that error message, you should be able to ignore it.   Check out my post

https://community.esri.com/thread/74093-tip-python-addins-getting-custom-toolstoolbox-to-work-gptool... 

DanPatterson_Retired
MVP Esteemed Contributor

cool... a bug http://support.esri.com/en/bugs/nimbus/TklNMDg5MjUz

to an old link which no longer exists "http://forums.arcgis.com/threads/84618-Tip-Python-Addin-getting-custom-tools-toolbox-to-work-GPToolD..."

for old software???

Does it still persist in 10.5.1 since I don't use addins

fengchen1
New Contributor

I use arcmap10.4 and is it still a bug?

0 Kudos
curtvprice
MVP Esteemed Contributor

feng, the error message really makes me think your use of underscores in your tool name is the problem. Have you tried renaming your tool so the name does not include an underscore? For example "ServiceArea" not "Service_Area". You can give the tool pretty label ("Feng's Service Area", but the tool name can't have any special characters.

0 Kudos
fengchen1
New Contributor

Hi, Curtis.

I tried the link and renamed the tool, but it still has the same problem. Below are the pictures of my revised code and steps. Could you please help me to check the problem? Thank you so much.

Fig.1

Fig.2 the contents of the Install folder

Fig.3 the contents of the script folder

0 Kudos
fengchen1
New Contributor

But the model cannot be executed no matter the error is ignored or not.

0 Kudos