Error 000824 - Feature to Point

2740
4
Jump to solution
05-13-2014 10:48 AM
ChristopherBlinn1
Occasional Contributor III
I did post in this discussion forum but felt like this was more of a Question/Answer forum post.

ArcGIS for Desktop 10.2.1
Python 2.7

Receiving "Tool is not licensed" error when running this code:

# Import arcpy module import arcpy from arcpy import env import os  # Overwrite pre-existing files arcpy.env.overwriteOutput = True  os.environ['ESRI_SOFTWARE_CLASS']='Professional' #Added based on forum suggestion arcpy.CheckOutExtension('Spatial') #Added based on forum suggestion  Input = "C:\\GIS_DATA\\FGDB.gdb\\InputPolygons" Input_Layer = "Feature_Layer" Output = "C:\\GIS_DATA\\FGDB.gdb\\OutputPoints"  try:    arcpy.MakeFeatureLayer_management(Input, Input_Layer, "", "", "field alias VISIBLE NONE")    arcpy.FeatureToPoint_management(Input_Layer, Output, "CENTROID")  except:    print arcpy.GetMessages()


Result:
Failed to execute. Parameters are not valid. ERROR 000824: The tool is not licensed. Failed to execute (FeatureToPoint).


Never had this issue before.  Migrating update scripts from one version of ArcGIS (10.0 SP5) to another (10.2.1).

Any help appreciated.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
I have encountered this as well...I think the problem is coming from importing arcpy first. You need to import arcinfo first, otherwise you will start an instance of whatever license you are normally consuming. Try doing this:

import arcinfo

# Import arcpy module
import arcpy
from arcpy import env
import os

# Overwrite pre-existing files
arcpy.env.overwriteOutput = True

Input = "C:\\GIS_DATA\\FGDB.gdb\\InputPolygons"
Input_Layer = "Feature_Layer"
Output = "C:\\GIS_DATA\\FGDB.gdb\\OutputPoints"

try:
   arcpy.MakeFeatureLayer_management(Input, Input_Layer, "", "", "field alias VISIBLE NONE")
   arcpy.FeatureToPoint_management(Input_Layer, Output, "CENTROID")

except:
   print arcpy.GetMessages()


Attempting to change the software class to Professional after importing arcpy will not work because importing arcpy is setting your class key to the current version. Also, you should not need to check out a spatial analyst license for this.

I liked your changing the os environment variable so I tested to make sure this also works:

import os
os.environ['ESRI_SOFTWARE_CLASS']='Professional'

import arcpy
print arcpy.ProductInfo()


Just make sure to import arcinfo or set the os environment to professional before importing arcpy.

View solution in original post

0 Kudos
4 Replies
by Anonymous User
Not applicable
I have encountered this as well...I think the problem is coming from importing arcpy first. You need to import arcinfo first, otherwise you will start an instance of whatever license you are normally consuming. Try doing this:

import arcinfo

# Import arcpy module
import arcpy
from arcpy import env
import os

# Overwrite pre-existing files
arcpy.env.overwriteOutput = True

Input = "C:\\GIS_DATA\\FGDB.gdb\\InputPolygons"
Input_Layer = "Feature_Layer"
Output = "C:\\GIS_DATA\\FGDB.gdb\\OutputPoints"

try:
   arcpy.MakeFeatureLayer_management(Input, Input_Layer, "", "", "field alias VISIBLE NONE")
   arcpy.FeatureToPoint_management(Input_Layer, Output, "CENTROID")

except:
   print arcpy.GetMessages()


Attempting to change the software class to Professional after importing arcpy will not work because importing arcpy is setting your class key to the current version. Also, you should not need to check out a spatial analyst license for this.

I liked your changing the os environment variable so I tested to make sure this also works:

import os
os.environ['ESRI_SOFTWARE_CLASS']='Professional'

import arcpy
print arcpy.ProductInfo()


Just make sure to import arcinfo or set the os environment to professional before importing arcpy.
0 Kudos
MichaelVolz
Esteemed Contributor
Christopher:

As per Caleb's very informative thread, are you running your script from a lower level version of ArcMap (e.g. your computer is licensed for Basic or Standard) but you are using a professional level license to access the spatial analyst in your python script?
0 Kudos
ChristopherBlinn1
Occasional Contributor III
IYou need to import arcinfo first, otherwise you will start an instance of whatever license you are normally consuming.


Interesting.. I only use ArcInfo or should I say "ArcGIS for Desktop Advanced" on this particular machine.

Anyways, I am trying your suggestion.  Will post back results soon.

Michael - Sorry didn't see your post when I replied.  I am running the scripts standalone (testing for a batch file).  When using the software, I have always used the Advanced license.  The machine is also an LM, hosting licenses for Basic and Standard as well, but Administrator is set to use Advanced.

Thanks,
Chris B.
0 Kudos
ChristopherBlinn1
Occasional Contributor III
The fix was adding:

import arcinfo


Thanks for the tips!
0 Kudos