Using pyc files for ArcGIS 10.1 Add-In

856
1
Jump to solution
07-12-2012 07:50 AM
MichaelMarkieta
New Contributor III
Can we use .pyc files for our ArcGIS Python Add-in?

This would be helpful for two things:


  1. Quicker executing add-in code

  2. 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)

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChrisFox3
Occasional Contributor III
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

View solution in original post

0 Kudos
1 Reply
ChrisFox3
Occasional Contributor III
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
0 Kudos