Checking System Information to set ArcToolbox Paths?

Discussion created by BrokenLegMike on Oct 3, 2011
Latest reply on Oct 3, 2011 by rdharles
Hey everyone,

I am trying to find a way to check my computer system information in order to set correct paths to the Arctoolbox using the older geoprocessor.

I have 2 computers:

One is my Windows XP Pro 32bit OS (version 5.1.2600).
The second is a Windows 7 64bit OS (version 6.1.7601).

I want to do a system check in order to set the correct path to ArcToolbox before the script continues to process.

I thought the following script would do this for me, but when I run it on the second computer (the second if statement or the windows 7 computer) I get a fatal error and ArcCatalogue closes. If I ran it on the first computer, the script runs find. If I were to reverse the if statements, the second computer will always crash in a fatal error. I've used an elif for the second computer, same result. I used an "else: pass" in the first statement, I get the same error.

I figured there should be an easy way to do a system check for the new Programs (x86) system path, but I'm not sure how to do it. Any suggestions?

import arcgisscripting, sys, platform
# Create the geoprocessor object
gp = arcgisscripting.create()

### Load required toolboxes...
##gp.AddToolbox("C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes/Data Management Tools.tbx")
##gp.AddToolbox("C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes/Analysis Tools.tbx")
# Load required toolboxes (Win7)

if platform.version() == '5.1.2600':
    gp.AddToolbox("C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx")
    gp.AddToolbox("C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Analysis Tools.tbx")

if platform.version() == '6.1.7601':
    gp.AddToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx")
    gp.AddToolbos("C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Analysis Tools.tbx")