At my organization, we have tons of ArcEditor licenses available and everyone is at that license level. We just purchased one ArcInfo license with the hopes that this can by checked out at certain times to use in tools in scripts that when we require ArcInfo tools. I have been reading over some of the documentation, and I cannot quite figure out how to use ArcInfo in a script. Here is my initial test:
I have been reading this page and it says that if the return value for the SetProduct is "AlreadyInitialized", then the license has already been set in the script. This does not appear to be the case, or the more likely scenario is that I am not doing this correctly.
According to the help docs:
Legacy:
The product level should be set by importing the appropriate product module (arcinfo, arceditor, arcview, arcserver, arcenginegeodb, arcengine) prior to importing arcpy. The SetProduct function is a legacy function and cannot set the product once arcpy has been imported.
I cannot import arcpy until I import the right module...I cannot directly import arcinfo as shown above (I'm assuming because I haven't initialized an instance of ArcInfo???). It does let me import arcinfo after I import arceditor though.
Has anyone had experience with temporarily setting the product to ArcInfo while a script is executing? Also, after the change to ArcInfo is successful, do I need to reset the product back to ArcEditor? How do I do this?
Code:
>>> import arcinfo
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import arcinfo
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcinfo.py", line 18, in <module>
gp.setProduct("ArcInfo")
RuntimeError: ERROR 999999: Error executing function.
>>> import arceditor
>>> import arcinfo
>>> import arcpy
>>> arcpy.ProductInfo()
u'ArcEditor'
>>> arcpy.SetProduct('ArcInfo')
u'AlreadyInitialized' # here it says ArcInfo has already been initialized, yet I still am not able to use the near tool
>>> pnts = r'C:\TEMP\PermitTest\Wtr_Val.shp'
>>> hyd = r'C:\TEMP\PermitTest\Wtr_Hyd.shp'
>>> arcpy.Near_analysis(pnts, pnts)
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
arcpy.Near_analysis(pnts, hyd)
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 794, in Near
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000824: The tool is not licensed.
Failed to execute (Near).
>>> arcpy.CheckProduct('ArcInfo')
u'Unavailable'According to the help docs:
Legacy:
The product level should be set by importing the appropriate product module (arcinfo, arceditor, arcview, arcserver, arcenginegeodb, arcengine) prior to importing arcpy. The SetProduct function is a legacy function and cannot set the product once arcpy has been imported.
I cannot import arcpy until I import the right module...I cannot directly import arcinfo as shown above (I'm assuming because I haven't initialized an instance of ArcInfo???). It does let me import arcinfo after I import arceditor though.
Has anyone had experience with temporarily setting the product to ArcInfo while a script is executing? Also, after the change to ArcInfo is successful, do I need to reset the product back to ArcEditor? How do I do this?