<?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: Why does GetInstallInfo('desktop') return info for Engine? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681872#M52817</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Xander.&amp;nbsp; I'll see if this will work for the developer.&amp;nbsp; It looks like it gives the correct information for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Feb 2015 15:57:20 GMT</pubDate>
    <dc:creator>JohnLovato</dc:creator>
    <dc:date>2015-02-11T15:57:20Z</dc:date>
    <item>
      <title>Why does GetInstallInfo('desktop') return info for Engine?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681868#M52813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When both engine and desktop 10.2 are installed on the same machine.&amp;nbsp; GetInstallInfo('desktop') returns information for the engine install.&amp;nbsp; See the sample code below.&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(198, 198, 198); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;Code&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcinfo&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;arcpy.SetProduct('ArcInfo')&lt;/P&gt;&lt;P&gt;for install in arcpy.ListInstallations():&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('\nINFO: for ' + install + ' installation')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Use the dictionary iteritems to iterate through &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp; the key/value pairs from GetInstallInfo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = arcpy.GetInstallInfo(install)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for key, value in d.iteritems():&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print a formatted string of the install key and its value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("{:&amp;lt;13} : {}".format(key, value))&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;P&gt;INFO: for desktop installation&lt;/P&gt;&lt;P&gt;SourceDir&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : ...\ESRI\ArcGIS10.2.2\Engine\windows\SetupFiles\&lt;/P&gt;&lt;P&gt;InstallDate&amp;nbsp;&amp;nbsp; : 7/28/2014&lt;/P&gt;&lt;P&gt;InstallDir&amp;nbsp;&amp;nbsp;&amp;nbsp; : c:\arcgis\engine10.2\&lt;/P&gt;&lt;P&gt;ProductName&amp;nbsp;&amp;nbsp; : Engine&lt;/P&gt;&lt;P&gt;BuildNumber&amp;nbsp;&amp;nbsp; : 3552&lt;/P&gt;&lt;P&gt;InstallType&amp;nbsp;&amp;nbsp; : Typical&lt;/P&gt;&lt;P&gt;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 10.2.2&lt;/P&gt;&lt;P&gt;SPNumber&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A&lt;/P&gt;&lt;P&gt;Installer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : install_user&lt;/P&gt;&lt;P&gt;SPBuild&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A&lt;/P&gt;&lt;P&gt;InstallTime&amp;nbsp;&amp;nbsp; : 12:48:48&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INFO: for engine installation&lt;/P&gt;&lt;P&gt;SourceDir&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : ...\ESRI\ArcGIS10.2.2\Engine\windows\SetupFiles\&lt;/P&gt;&lt;P&gt;InstallDate&amp;nbsp;&amp;nbsp; : 7/28/2014&lt;/P&gt;&lt;P&gt;InstallDir&amp;nbsp;&amp;nbsp;&amp;nbsp; : c:\arcgis\engine10.2\&lt;/P&gt;&lt;P&gt;ProductName&amp;nbsp;&amp;nbsp; : Engine&lt;/P&gt;&lt;P&gt;BuildNumber&amp;nbsp;&amp;nbsp; : 3552&lt;/P&gt;&lt;P&gt;InstallType&amp;nbsp;&amp;nbsp; : Typical&lt;/P&gt;&lt;P&gt;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 10.2.2&lt;/P&gt;&lt;P&gt;SPNumber&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A&lt;/P&gt;&lt;P&gt;Installer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : install_user&lt;/P&gt;&lt;P&gt;SPBuild&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A&lt;/P&gt;&lt;P&gt;InstallTime&amp;nbsp;&amp;nbsp; : 12:48:48&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 14:19:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681868#M52813</guid>
      <dc:creator>JohnLovato</dc:creator>
      <dc:date>2015-02-11T14:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why does GetInstallInfo('desktop') return info for Engine?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681869#M52814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The GetInstallInfo (arcpy) does not use the provided parameter. See the help:&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/GetInstallInfo/03q300000006000000/" title="http://resources.arcgis.com/en/help/main/10.2/index.html#/GetInstallInfo/03q300000006000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my ase it returns this output (twice the same info):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;INFO: for desktop installation
SourceDir&amp;nbsp;&amp;nbsp;&amp;nbsp; : C:\Users\xbakker\Documents\ArcGIS 10.3\Desktop\SetupFiles\
InstallDate&amp;nbsp; : 2014/12/16
InstallDir&amp;nbsp;&amp;nbsp;&amp;nbsp; : c:\program files (x86)\arcgis\desktop10.3\
ProductName&amp;nbsp; : Desktop
BuildNumber&amp;nbsp; : 4322
InstallType&amp;nbsp; : N/A
Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 10.3
SPNumber&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A
Installer&amp;nbsp;&amp;nbsp;&amp;nbsp; : xbakker
SPBuild&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A
InstallTime&amp;nbsp; : 16:07:59


INFO: for explorer installation
SourceDir&amp;nbsp;&amp;nbsp;&amp;nbsp; : C:\Users\xbakker\Documents\ArcGIS 10.3\Desktop\SetupFiles\
InstallDate&amp;nbsp; : 2014/12/16
InstallDir&amp;nbsp;&amp;nbsp;&amp;nbsp; : c:\program files (x86)\arcgis\desktop10.3\
ProductName&amp;nbsp; : Desktop
BuildNumber&amp;nbsp; : 4322
InstallType&amp;nbsp; : N/A
Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 10.3
SPNumber&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A
Installer&amp;nbsp;&amp;nbsp;&amp;nbsp; : xbakker
SPBuild&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : N/A
InstallTime&amp;nbsp; : 16:07:59&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW:&amp;nbsp; you can remove the line:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;arcpy.SetProduct('ArcInfo')&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;This does not do anything, since the license level is determined when you import arcpy or as you do with setting the license level using the import arcinfo. Note that in 10.3 there is a bug and it you cannot set the license level from a stand alone script, it will simply consume the highest license available...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:41:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681869#M52814</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T04:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why does GetInstallInfo('desktop') return info for Engine?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681870#M52815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander,&lt;/P&gt;&lt;P&gt;&amp;nbsp; What method should be used to return only&amp;nbsp; desktop installation directory?&amp;nbsp; The developer used GetInstallInfo()[InstallDir] in the past, but that won't work when both engine and desktop are on the same machine.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;John P. Lovato&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 14:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681870#M52815</guid>
      <dc:creator>JohnLovato</dc:creator>
      <dc:date>2015-02-11T14:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why does GetInstallInfo('desktop') return info for Engine?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681871#M52816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The alternative could be looking at the path settings:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import sys
for p in sys.path:
&amp;nbsp;&amp;nbsp;&amp;nbsp; p = p.lower()
&amp;nbsp;&amp;nbsp;&amp;nbsp; if "arcgis\\desktop" in p and p.endswith('bin'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print p&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681871#M52816</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T04:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why does GetInstallInfo('desktop') return info for Engine?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681872#M52817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Xander.&amp;nbsp; I'll see if this will work for the developer.&amp;nbsp; It looks like it gives the correct information for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 15:57:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681872#M52817</guid>
      <dc:creator>JohnLovato</dc:creator>
      <dc:date>2015-02-11T15:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why does GetInstallInfo('desktop') return info for Engine?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681873#M52818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a couple of things going on here.&amp;nbsp; First, &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.GetInstallInfo&lt;/SPAN&gt; has no parameters.&amp;nbsp; It will accept an argument and not throw an error, but any argument that is passed doesn't affect the results of what is returned.&amp;nbsp; The &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.GetInstallInfo&lt;/SPAN&gt; function gets the installation information that relates to the currently loaded ArcPy site package, which in your case is ArcGIS Engine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you install ArcGIS Desktop and ArcGIS Engine on the same machine using standard installation instructions, the two will share a single Python interpreter, usually C:\Python27\ArcGIS10.x (10.2 in this case).&amp;nbsp; Another way to look at it is that a single Python interpreter has 2 ArcPy site packages registered/installed.&amp;nbsp; Since the site packages have the same name (arcpy), they both can't be loaded into the interpreter at the same time.&amp;nbsp; When the interpreter encounters an &lt;SPAN style="font-family: courier new,courier;"&gt;import arcpy&lt;/SPAN&gt; statement, it will find and import whichever site package is found first in the search path for modules, i.e., &lt;SPAN style="font-family: courier new,courier;"&gt;sys.path&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before importing ArcPy, you can quickly determine which ArcPy site package will be loaded by running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import imp
imp.find_module('arcpy')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the result will come back with ...\Engine10.2\... since it comes first in the &lt;SPAN style="font-family: courier new,courier;"&gt;sys.path&lt;/SPAN&gt;.&amp;nbsp; Reversing the order of &lt;SPAN style="font-family: courier new,courier;"&gt;sys.path&lt;/SPAN&gt; before importing ArcPy will likely find and import the Desktop site package for your situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import imp
import sys
sys.path.reverse()
imp.find_module('arcpy')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue with reversing &lt;SPAN style="font-family: courier new,courier;"&gt;sys.path&lt;/SPAN&gt; out of hand is that it will import the Engine-based site package if ArcGIS Engine was installed first.&amp;nbsp; There are a couple of more thoughtful ways to get around this problem.&amp;nbsp; First, setting the PYTHONPATH Windows environment variable to the Desktop-based site package will ensure that it is loaded first regardless of the &lt;SPAN style="font-family: courier new,courier;"&gt;sys.path&lt;/SPAN&gt; order.&amp;nbsp; However, in this case, it seems you don't already know that location and am trying to figure it out.&amp;nbsp; A second approach would be to remove all of the Engine-related entries in&lt;SPAN style="font-family: courier new,courier;"&gt; sys.path&lt;/SPAN&gt; before &lt;SPAN style="font-family: courier new,courier;"&gt;import arcpy&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import sys
for p in sys.path[:]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if 'Engine' in p:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.path.remove(p)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the goal is to determine whether ArcGIS Desktop is installed and where, maybe querying a WMI service for installed applications and information is a better approach.&amp;nbsp; Adapted from the &lt;A href="https://technet.microsoft.com/en-us/scriptcenter/bb410849.aspx" rel="nofollow noopener noreferrer" target="_blank"&gt;Microsoft Script Center &lt;/A&gt;&lt;A href="https://technet.microsoft.com/en-us/scriptcenter/bb410849.aspx" rel="nofollow noopener noreferrer" target="_blank"&gt;List Installed Software &lt;/A&gt;Python script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import win32com.client 
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") 
objSWbemServices = objWMIService.ConnectServer(".", "root\cimv2") 
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product "
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "where Name Like 'ArcGIS % for Desktop'") 
for objItem in colItems: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Name: ", objItem.Name 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Install Date: ", objItem.InstallDate 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Install Location: ", objItem.InstallLocation
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ""&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:41:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-getinstallinfo-desktop-return-info-for/m-p/681873#M52818</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T04:41:56Z</dc:date>
    </item>
  </channel>
</rss>

