SetProduct (arcpy)
Récapitulatif
The SetProduct function defines the desktop license. SetProduct returns information on the license.

The product level should be set by importing the appropriate product module (arcinfo, arceditor, arcview, arcserver, arcenginegeodb, or arcengine) prior to importing arcpy. The SetProduct function is a legacy function and cannot set the product once arcpy has been imported.
For scripts using the arcgisscripting module, the equivalent SetProduct method is still supported.
Discussion

La définition du produit et des extensions est uniquement nécessaire dans les scripts autonomes. Si vous exécutez des outils à partir de la fenêtre Python ou à l'aide d'outils de script, le produit est déjà défini à partir de l'application et les extensions actives sont basées sur la boîte de dialogue Extensions.
Syntaxe
Paramètre | Explication | Type de données |
product |
Product code for the product being set.
| String |
Type de données | Explication |
String |
The function returns the status on the product license. There are four possible values:
|
Exemple de code
Sets an ArcGIS for Desktop Basic product license using the arcview module.
# Set the ArcGIS for Desktop Basic 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)