<?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: CheckOutExtension and ImportXMLWorkspaceDocument problem in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298319#M23083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I got it to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I did was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make the tool create a batch .bat file with the command to run the python 2.7 and the python script to do all the processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the tool gets all the parameters via the def getParameterInfo, and uses a python template program minus the parameters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it creates a new temporary python script it adds the parameters to the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then using subprocess.call (one uses 'import subprocess' to get access to it) run the bat file with the new temporary python script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It created everything I desired. So the ArcMap we have does not have the advanced license but the python 2.7 under ArcGIS does!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jul 2016 19:21:32 GMT</pubDate>
    <dc:creator>PaulHacker2</dc:creator>
    <dc:date>2016-07-07T19:21:32Z</dc:date>
    <item>
      <title>CheckOutExtension and ImportXMLWorkspaceDocument problem</title>
      <link>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298315#M23079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I am copying GDB extensions from XML templates.&lt;/P&gt;&lt;P&gt;I am making a Python Toolbox from a Python script that runs perfectly if I run it alone using Python IDLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when running the tool it works fine except for the last, where I import the XML to overlay the GDB I created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 282, in execute&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\management.py", line 1196, in ImportXMLWorkspaceDocument&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/P&gt;&lt;P&gt;ERROR 000824: The tool is not licensed.&lt;/P&gt;&lt;P&gt;Failed to execute (ImportXMLWorkspaceDocument). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect I do not have a license for the ImportXMLWorkspaceDocument.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand I can check with 'arcpy.CheckExtension' and if there is one I can use 'arcpy.CheckOutExtension' and 'arcpy.CheckInExtension'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what group is I&lt;SPAN style="text-decoration: underline;"&gt;mportXMLWorkspaceDocument&lt;/SPAN&gt; part of? Is it 'Spatial'? 'Datareviewer'? or what? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the list but don't know what part ImportXMLWorkspaceDocument belongs to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jun 2016 14:24:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298315#M23079</guid>
      <dc:creator>PaulHacker2</dc:creator>
      <dc:date>2016-06-29T14:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: CheckOutExtension and ImportXMLWorkspaceDocument problem</title>
      <link>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298316#M23080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need to check out an extension, you need to ensure your ArcMap/Catalog is using a standard (aka arceditor) or advanced (aka arcinfo) level license, see &lt;A href="https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/import-xml-workspace-document.htm" title="https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/import-xml-workspace-document.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Import XML Workspace Document—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your python toolbox, use the arcpy.ProductInfo() function in the "isLicensed" method in your tool to disable the tool if ArcMap/Catalog is using a basic/arcview license.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
class Toolbox(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.label = "Toolbox"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.alias = ""

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # List of tool classes associated with this toolbox
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.tools = [Tool]

class Tool(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; init code etc...

&amp;nbsp;&amp;nbsp;&amp;nbsp; def isLicensed(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Set whether tool is licensed to execute."""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.ProductInfo() != u'ArcView'&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason your code works when run from Python/IDLE is that when you import arcpy *from outside ArcGIS*, it will automatically grab the highest available license level (i.e it will try advanced if available, standard if not or basic if all else fails).&amp;nbsp; You can specify what license level you want by using "import arcview, arcpy" or "import arceditor, arcpy" etc... NOTE: You can not use this method in your tool to change your current license level*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*You might be able to work around this by ensuring the script is run outside of the current ArcGIS process (maybe using background geoprocessing, or the subprocess module to force a new python process), and then setting your license level in the script to standard or advanced.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298316#M23080</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-11T14:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: CheckOutExtension and ImportXMLWorkspaceDocument problem</title>
      <link>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298317#M23081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I find we don't have the advanced licenses and thus running it strait by python tools won't do. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, since it works perfectly outside using python IDLE how does one set the parameters in the tools and then 'batch' it to run? That is using the same pyt script I have in the toolbox to input all the parameters and then send them to a batch .py script to run with IDLE?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2016 13:38:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298317#M23081</guid>
      <dc:creator>PaulHacker2</dc:creator>
      <dc:date>2016-07-06T13:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: CheckOutExtension and ImportXMLWorkspaceDocument problem</title>
      <link>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298318#M23082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are only two possibilities:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If you don't have advanced or standard licenses available, you &lt;EM&gt;can't&lt;/EM&gt; use the ImportXMLWorkspaceDocument&amp;nbsp; tool.&lt;/LI&gt;&lt;LI&gt;If the tool is running outside of ArcGIS, then you &lt;EM&gt;do&lt;/EM&gt; have advanced or standard licenses available.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may be having trouble switching from a basic to a standard or advanced license. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2016 01:40:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298318#M23082</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2016-07-07T01:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: CheckOutExtension and ImportXMLWorkspaceDocument problem</title>
      <link>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298319#M23083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I got it to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I did was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make the tool create a batch .bat file with the command to run the python 2.7 and the python script to do all the processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the tool gets all the parameters via the def getParameterInfo, and uses a python template program minus the parameters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it creates a new temporary python script it adds the parameters to the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then using subprocess.call (one uses 'import subprocess' to get access to it) run the bat file with the new temporary python script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It created everything I desired. So the ArcMap we have does not have the advanced license but the python 2.7 under ArcGIS does!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2016 19:21:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/checkoutextension-and-importxmlworkspacedocument/m-p/298319#M23083</guid>
      <dc:creator>PaulHacker2</dc:creator>
      <dc:date>2016-07-07T19:21:32Z</dc:date>
    </item>
  </channel>
</rss>

