AnsweredAssumed Answered

check license availability using python

Question asked by gisbert61 on Jun 6, 2016
Latest reply on Jul 12, 2016 by gisbert61

Hello All,

We have a license server serving three concurrent (basic) licenses. During daytime these are in use by my collegues and myself, during nighttime I've some python scripts managing and updating our AGOL environment.

Now, I want to check if my scripts can obtain a license and if not, log this ( or retry after some time or send me a mail) so I tried this:

import arcpy
from arcpy import env
import sys

if arcpy.CheckProduct("arcview")=="Available":
    print "License is available"
    print "No license available"
#    Send a mail or something


But this either results in "License is available" or Python gives me a traceback ending in: RuntimeError: NotInitialized from which I understand that arcpy cannot be imported. (Which seems reasonable considering I need a license to use arcpy)


Is there a way to check the availability of a license without getting this error? I would like to end up in the else: clause so I can send me a mail to notify no backup is made.


thanks in advance,