Python arcpy.GetParameter() Examples

The following are 1 code examples of arcpy.GetParameter(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module arcpy , or try the search function .
Example #1
Source File: install_arcrest.py    From ArcREST with Apache License 2.0 4 votes vote down vote up
def main():
    arcrestZip = 'arcrest.zip'
    arcrestHelperZip = 'arcresthelper.zip'

    get_latest = arcpy.GetParameter(0)
    installInBoth = arcpy.GetParameter(1)
    base_folder = os.path.dirname(__file__)
    #arcpy.AddMessage("%s: " % base_folder)
    base_folder = os.path.dirname(base_folder)
    #arcpy.AddMessage("%s: " % base_folder)
    base_folder = os.path.dirname(base_folder)
    #arcpy.AddMessage("%s: " % base_folder)
    base_file = os.path.splitext(os.path.basename(__file__))[0]

    if get_latest:
        arcrest_zip, arcresthelper_zip = download_arcrest()
    else:
        commondata = os.path.join(base_folder, "commondata")
        if os.path.isdir(os.path.join(commondata, base_file)):
            arcrest_zip = os.path.join(commondata,base_file, arcrestZip)
            arcresthelper_zip = os.path.join(commondata, base_file, arcrestHelperZip)
        elif os.path.isdir(os.path.join(commondata, "userdata")):
            arcrest_zip = os.path.join(commondata, "userdata", arcrestZip)
            arcresthelper_zip = os.path.join(commondata,  "userdata", arcrestHelperZip)

    site_package = None
    site_package64 = None
    defPath =  os.path.dirname(os.__file__)
    if ('ArcGIS' in defPath):
        if ('x64' in defPath):
            site_package = os.path.join(defPath.replace('x64',''), 'site-packages')
            site_package64 = os.path.join(defPath, 'site-packages')
        else:
            site_package = os.path.join(defPath, 'site-packages')
            site_package64 = os.path.join(defPath.replace('ArcGIS','ArcGISx64'), 'site-packages')
    else:
        site_package = os.path.join(defPath,'site-packages')
##    for p in sys.path:
##        if p.lower().find("site-packages") > -1:
##            site_package = p
##            break
##        del p
    if site_package is None:
        raise arcpy.ExecuteError("Could not find the site-package folder")
    installPackages(arcrest_zip,arcresthelper_zip, site_package)

    if site_package64 is not None and installInBoth == True:
        arcpy.AddMessage(" ")
        arcpy.AddMessage("-----------------------------------------------")
        arcpy.AddMessage(" ")
        installPackages(arcrest_zip,arcresthelper_zip, site_package64)
    arcpy.AddMessage(" ")
    arcpy.AddMessage("... Process Complete ...".format(site_package))