Can't check out BA extension in Python (standalone)

1706
2
08-26-2011 02:08 PM
BradPender
New Contributor
Title sums it up, with a standalone python script run through the IDLE editor/debugger, the BA extension reports unavailable. Network Analyst checks out fine and both extensions are shown as licensed and available in the administrator app.

From within the Python IDLE app arcpy imports fine, functions that don't require an extension work fine, Network Analyst extension shows available and checks out/in fine, just not BA.  The script runs from the Python window within ArcMap just fine.

class LicenseError(Exception):
    pass

import arcview
import arcpy

try:
    if arcpy.CheckExtension("Business") == "Available":
        arcpy.CheckOutExtension("Business")
    else:
        raise LicenseError

    arcpy.CheckInExtension("Business")

except LicenseError:
    print "Business Analyst license is unavailable"
except:
    print arcpy.GetMessages(2)
0 Kudos
2 Replies
Jason_RobinsonRobinson
Esri Regular Contributor
Brad,

I can't recall if you have BA10 Premium but if so try this:

Import arcpy module
import arcpy
import arcview
arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Business Analyst Tools.tbx")
# Check out any necessary licenses
arcpy.CheckOutExtension("BusinessPrem")

Basically replacing "Business" with "BusinessPrem"
0 Kudos
BradPender
New Contributor

...Basically replacing "Business" with "BusinessPrem"


That did the trick. Thank Jason!
0 Kudos