Can we use .pyc files for our ArcGIS Python Add-in?
This would be helpful for two things:
Quicker executing add-in code
Including non-standard python modules/libraries with the Add-In as pyc files only (eg. wxPython precompiles to pyc on installation because there are usually no instances where source code need to be altered)
Yes, you can do this. This is how I was able to accomplish it:
1. Copy your .pyc file into the install folder of the add-in project 2. In the .py file that is created from the add-in wizard add the following code after the import statements:
import sys, os sys.path.append(os.path.dirname(__file__)) import yourmodulename
Yes, you can do this. This is how I was able to accomplish it:
1. Copy your .pyc file into the install folder of the add-in project 2. In the .py file that is created from the add-in wizard add the following code after the import statements:
import sys, os sys.path.append(os.path.dirname(__file__)) import yourmodulename