SetProduct

Summary

The SetProduct function defines the desktop license. SetProduct returns information on the license.

LegacyLegacy:

The product level should be set by importing the appropriate product module (arcinfo, arceditor, arcview, arcserver, arcenginegeodb, arcengine) prior to importing arcpy. The SetProduct function is a legacy function and cannot set the product once arcpy has been imported.

Discussion

TipTip:

The setting of the product and extensions is only necessary within stand-alone scripts. If you are running tools from the Python window or using script tools, the product is already set from within the application, and the active extensions are based on the Extensions dialog box.

Syntax

SetProduct (code)
ParameterExplanationData Type
code

Product code for the product being set.

  • arcviewArcView product code.
  • arceditorArcEditor product code.
  • arcInfoArcInfo product code.
  • engineEngine Runtime product code.
  • enginegeodbEngine Geodatabase Update product code.
  • arcserverServer product code.
String
Return Value
Data TypeExplanation
String

The function returns the status on the product license. There are four possible values:

  • CheckedOutLicense successfully set.
  • AlreadyInitializedLicense has already been set.
  • NotLicensedThe license is not valid or available.
  • FailedA system failure occurred during the set request.

Code Sample

SetProduct example

Sets an ArcView product license using the arcview module.

# Set the ArcView product by importing the arcview module.
#
import arcview
import arcpy

arcpy.env.workspace = "C:/Data/SanDiego.gdb"

arcpy.CreateRasterDataset_management(arcpy.env.workspace,
      "LandUse", "30", "8_BIT_UNSIGNED", "Freeways", 1)
 

Related Topics


10/28/2011