0

I have a standalone Python script that during initialization verifies if the ArcInfo license is being used, and if it isn't attempts to set the license to ArcInfo. It works fine with arcpy/python 2.7/ArcGIS Desktop 10.8.1. However, we are in the process of moving to ArcGIS Pro (v. 2.9) and now this functionality does not seem to be working. When the code runs it never sets the license to ArcInfo, it always stays at ArcView despite there being 4 available ArcInfo licenses on the license server.

I have a simplified version of the code below, of which I have also tested and have the same problem

import arcpy

sLicense = arcpy.ProductInfo()
if sLicense != 'ArcInfo':
    arcpy.SetProduct('arcinfo')
    if arcpy.ProductInfo() != 'ArcInfo':
        bError = True
if bError: print('failed, {0}'.format(arcpy.ProductInfo()))
else: print('worked, {0}'.format(arcpy.ProductInfo()))

1 Answer 1

2

The 10.3 documentation states:

Legacy: The product level should be set by importing the appropriate product module (arcinfo, arceditor, arcview, arcserver, arcenginegeodb, or arcengine) prior to importing arcpy. The SetProduct function is a legacy function and cannot set the product once arcpy has been imported.

For scripts using the arcgisscripting module, the equivalent SetProduct method is still supported.

So this procedure has been deprecated for a long time. Attempting to use it in ArcGIS Pro isn't going to work.

In fact, use of SetProduct is so old, if you follow the 10.3 documentation:

import arcinfo
import arcpy

you get another deprecation warning:

Warning (from warnings module):
  File "D:\gis_se\lictest.py", line 2
    import arcinfo
DeprecationWarning: Product and extension licensing is no longer handled with this method.

It looks like you need to change your active license choice within Pro, and just test the required level before execution:

import arcpy

if (arcpy.ProductInfo() != 'ArcInfo'):
    raise Exception("ArcInfo license level not set!")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.