Select to view content in your preferred language

Python Add-In - Deployment

1227
6
Jump to solution
03-16-2018 08:52 PM
ChrisHolmes
Frequent Contributor

Hello all,

I know that I can drag files into the "Install" folder for an add-in and those files will be packaged with the add-in (and I assume installed locally). What I'm wondering is if I drag a python toolbox (that has a few models and a number of script tools) into the install folder. The scripts that the script tools link to are located on the network. 

Is there any way to have the scripts also in the "Install" folder so that all models/scripts will run locally? It's quite possible that I am confused around this topic and where different things are executing.

Thanks

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

If you drag the toolbox over, I see no way that the associated scripts will also.  A toolbox with an embedded script would.  I normally store the tool box and associated scripts in the same folder (or the scripts in a Scripts folder within that folder) and ensure that each script tools is set to be 'relative' to the location of the toolbox

View solution in original post

6 Replies
DanPatterson_Retired
MVP Emeritus

If you drag the toolbox over, I see no way that the associated scripts will also.  A toolbox with an embedded script would.  I normally store the tool box and associated scripts in the same folder (or the scripts in a Scripts folder within that folder) and ensure that each script tools is set to be 'relative' to the location of the toolbox

ChrisHolmes
Frequent Contributor

Thank you Dan. ‘Relative’ would then have the script in the same location as the toolbox.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

I agree with Dan that relative works better.  FWIW, I was running into an issue in 10.5.x (wasn't an issue in 10.2.x) where using a network UNC/share-name would stick the local drive letter in front of the path so it wouldn't be found anymore.

if you are talking about an actual addin (i.e. Starting with the wizard to setup the addin) I know once you have the addin installed, you can usually copy the folder with the <ID> to a new machine and it will find everything, if that helps.  I was having issues with the .addin file installing in 10.5.1 by just double clicking, but just fully upgrading from 10.3.1 right now, so I just may not have figured out the trick.  Addins like these do not work in Pro, but you can usually go to the toolbox and make it work.  I also have not included models in my addins, however, in case it helps, I do have a doc that contains some times for Python addins 

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

It started out as a worksaround and info about that error  but I have a few other tips I have discovered.  Fwiw.

ChrisHolmes
Frequent Contributor

Thanks Rebecca. Your document is very helpful!

0 Kudos
ChrisHolmes
Frequent Contributor

Quick question, is it fine to change the addin version number just by editing it in the config.xml file rather than opening up the wizard and doing it there? thanks

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

I never run the wizard once I have stubbed it out.  The rest I do in code. So, I would say yes.  But I do have to run the makeaddin.py again it I want it to bundle the addin into a .addin file for distribution.  The .addin file is really just a .zip file, so you could in theory rename the .addin to zip, edit the file, and rename. But rremember, it will be out of sync if you haven't edited the source config.xml and then run the makeaddin.py again.

Important: always keep a backup before doing this.

I have actually tried to keep my versions as 10.2.x because it seems that I had other versioning errors.  But that may have been just me and maybe I caused it by doing something else. Hard to know for sure.

0 Kudos