<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: check license availability using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345224#M27106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about wrapping the whole if/then in a try/except?... If something goes wrong, you can send yourself an email.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Aug 2020 16:57:18 GMT</pubDate>
    <dc:creator>Arne_Gelfert</dc:creator>
    <dc:date>2020-08-11T16:57:18Z</dc:date>
    <item>
      <title>check license availability using python</title>
      <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345219#M27101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
import sys

if arcpy.CheckProduct("arcview")=="Available":
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "License is available"
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "No license available"
#&amp;nbsp;&amp;nbsp;&amp;nbsp; Send a mail or something
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:16:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345219#M27101</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2021-12-11T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: check license availability using python</title>
      <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345220#M27102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would have gotten a different error if arcpy couldn't be imported.&amp;nbsp; The error that you cite has to do with what follows your try-except block.&amp;nbsp; You will notice that in the web example, they bail completely with a sys.exit() which makes sense, since if arcmap isn't available (even at a basic license) you have bigger issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2016 09:24:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345220#M27102</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-06T09:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: check license availability using python</title>
      <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345221#M27103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may be interested in this help file &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/python/access-to-licensing-and-extensions.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/analyze/python/access-to-licensing-and-extensions.htm"&gt;Accessing licenses and extensions in Python—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2016 12:07:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345221#M27103</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2016-06-06T12:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: check license availability using python</title>
      <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345222#M27104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry it took so long to respond, a holiday was interfering ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing follows my try-except block (I don't even have one), what you see is what i wrote.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What web example are you referring to please? Is it the one Wes Miller refers to?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 06:34:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345222#M27104</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2016-07-13T06:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: check license availability using python</title>
      <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345223#M27105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FYI documentation:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/checkproduct.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/checkproduct.htm"&gt;CheckProduct—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2020 15:40:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345223#M27105</guid>
      <dc:creator>AndresCastillo</dc:creator>
      <dc:date>2020-08-11T15:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: check license availability using python</title>
      <link>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345224#M27106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about wrapping the whole if/then in a try/except?... If something goes wrong, you can send yourself an email.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2020 16:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-license-availability-using-python/m-p/345224#M27106</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-08-11T16:57:18Z</dc:date>
    </item>
  </channel>
</rss>

