Using additional Python modules

1873
2
Jump to solution
11-20-2013 09:58 AM
TimBarnes
Occasional Contributor III
Hi there
If I call an additional python module installed on my machine (i.e. https://code.google.com/p/simplekml/) from a python addin button, does that module need to be installed on every machine where the button is used? Or does it somehow package up any extra functionality it calls in the .addin file?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JasonScheirer
Occasional Contributor III
In the install\ directory in your Python Add-In project, copy the simplekml\ folder (the one with the __init__.py in it). So your project will look like this:

MyProject\     config.xml     makeaddin.py     Images\     Install\         MyProject_addin.py         simplekml\             __init__.py             abstractview.py             base.py             constants.py             coordinates.py             featgeom.py             icon.py             kml.py             makeunicode.py             model.py             networklinkcontrol.py             overlay.py             region.py             schema.py             styleselector.py             substyle.py             timeprimitive.py             tour.py


That should be sufficient to bundle simplekml with your addin. To find the local files for bundling, you can open a Python prompt in ArcMap or whatever and use

import imp print imp.find_module('simplekml')

View solution in original post

0 Kudos
2 Replies
JasonScheirer
Occasional Contributor III
In the install\ directory in your Python Add-In project, copy the simplekml\ folder (the one with the __init__.py in it). So your project will look like this:

MyProject\     config.xml     makeaddin.py     Images\     Install\         MyProject_addin.py         simplekml\             __init__.py             abstractview.py             base.py             constants.py             coordinates.py             featgeom.py             icon.py             kml.py             makeunicode.py             model.py             networklinkcontrol.py             overlay.py             region.py             schema.py             styleselector.py             substyle.py             timeprimitive.py             tour.py


That should be sufficient to bundle simplekml with your addin. To find the local files for bundling, you can open a Python prompt in ArcMap or whatever and use

import imp print imp.find_module('simplekml')
0 Kudos
TimBarnes
Occasional Contributor III
Awesome, thanks Jason 🙂
0 Kudos