stsnider

python export in modelbuilder sets product license in code

Discussion created by stsnider on Jan 5, 2012
Latest reply on Jan 11, 2012 by rgthurau
I'm running Arcgis Desktop 10 SP3.  I use model builder and export the models to python scripts which are executed in a batch script that runs every night.   The python scripts worked fine until a few weeks ago when I installed Service Patch 3. 

The problem is that the models that were created with SP2 have a line of the code that sets the product license level to ArcEditor.  We don't have any ArcEditor licenses, but do have several ArcInfo licenses (which is the license level the model was created with).  The models that were created recently (SP3) do not have the license set code in the python scripts and they run fine. 

I tried re-exporting the SP2 model to python scripts, but they continue to add the license set code.   Why???  The solution is easy enough...I open the script and remove the license set code, but its a pain when the model's "export to script" should just work correctly and not add that code.  The SP2 and SP3 models run without error in ArcCatalog.  It is only a problem with the exported python script.

Any suggestions?

License set code is SP2 python scripts created with model builder
# Set the necessary product code
import arceditor


Error message when I run the SP2 script:
C:\AGS_mxd\Scripts>BCA_ProjectTracking.py
Traceback (most recent call last):
  File "C:\AGS_mxd\Scripts\BCA_ProjectTracking.py", line 9, in <module>
    import arceditor
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arceditor.py", line 18, in <mo
dule>
    gp.setProduct("ArcEditor")
RuntimeError: ERROR 999999: Error executing function.

Outcomes