Running SelectLayerByAttribute outside ESRI environment Gives ERROR 000824

Discussion created by mhadi11 on Sep 19, 2013
Hi all,

Windows: Windows Server 2008 R2 SP1
Product: Arc GIS Desktop 10 (ArcInfo), ArcGIS Server Enterprise Advanced 10
Python: 2.6 32bit

I am not facing this issue in either ArcMap or Geoprocessing Server under ArcGIS Server I did not even needed to initialize any licences in these environment as it is already set.

But when I am trying to run same code code using PythonWin, Python Command Line, Python Visual Studio Tools 2.0 I get
ERROR 000824 The tool is not licensed.

I have went through this article tried using ProductInfo CheckProduct  legacy SetProduct and even importing arcinfo.

I am not sure what I am missing to make ArcGIS Server or even ArcInfo licensed in Python.:confused:

>>> import arcinfo
>>> import arcpy
>>> mapDocument = arcpy.mapping.MapDocument("C:\Python.mxd")
>>> Layer = arcpy.mapping.ListLayers(mapDocument,"Boundaries")[0]
>>> arcpy.SelectLayerByAttribute_management(Layer,"NEW_SELECTION","OBJECTID = 1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\", line 4259, in SelectLayerByAttribute
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000824: The tool is not licensed.
Failed to execute (SelectLayerByAttribute).
>>> arcpy.CheckProduct("arcinfo")u'NotLicensed'
>>> arcpy.ProductInfo()
>>> arcpy.SetProduct("arcinfo")