Trying to run SplitByAttributes in Python, and it keeps telling me that it's not licensed.

2405
15
Jump to solution
01-20-2017 08:33 AM
EricHeinrichs
Occasional Contributor

 I am trying to run this tool, Split By Attributes, in a Python script, and it keeps telling me that it's not licensed.

The page says it's available for all levels of ArcGIS Desktop (I am running Standard). 

I am not sure why it's throwing this error. Any idea on how to get around this?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
IanMurray
Frequent Contributor

"Failed to execute (Frequency)."

I'm wondering if Split Layer by Attribute is dependant on the Frequency Geoprocessing Tool, which is an advanced only license, therefore causing the script to fail.

http://pro.arcgis.com/en/pro-app/tool-reference/analysis/frequency.htm

Dan_Patterson‌, bixb0012‌, someone smarter than me have any idea on this?

View solution in original post

15 Replies
IanMurray
Frequent Contributor

What version of ArcMap are you running?

0 Kudos
EricHeinrichs
Occasional Contributor

ArcMap 10.5

0 Kudos
IanMurray
Frequent Contributor

You can check to see if your code is pulling a license and what license level using the licensing functions.  You can also manually set your license level for the script using this. 

http://desktop.arcgis.com/en/arcmap/latest/analyze/python/access-to-licensing-and-extensions.htm

You mind posting your code as well?

0 Kudos
EricHeinrichs
Occasional Contributor
import os
import arceditor
import arcpy

print arcpy.CheckProduct("ArcEditor")

arcpy.env.workspace = r"G:\user\Final Parcels\/"

print "************** STARTING ********************"


arcpy.SplitByAttributes_analysis("G:\user\Test Publishing.gdb\SmallParcels", "G:\user\Small Parcel SHPs", "SectionName")‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Here's the relevant piece of my Python code. It fails as soon as it gets to SplitByAttributes. It returns "Available" when running CheckProduct. 

Also, here's the error I get when it fails.

ERROR 000824: The tool is not licensed.
Failed to execute (Frequency).

Failed to execute (SplitByAttributes).

IanMurray
Frequent Contributor

"Failed to execute (Frequency)."

I'm wondering if Split Layer by Attribute is dependant on the Frequency Geoprocessing Tool, which is an advanced only license, therefore causing the script to fail.

http://pro.arcgis.com/en/pro-app/tool-reference/analysis/frequency.htm

Dan_Patterson‌, bixb0012‌, someone smarter than me have any idea on this?

EricHeinrichs
Occasional Contributor

I just looked through the code of the Split By Attributes script, and it is indeed calling the Frequency GP tool.

I wonder why they would say that Split By Attribute is available for all levels, when you can't run it without Frequency...

0 Kudos
DanPatterson_Retired
MVP Emeritus

You might have to go old school... SplitLayerByAttributes

has worked for quite a while, if you follow the rules about what is accepted as inputs and outputs.

And really.... Frequency should be standard, hence

Field Statistics 

was also written as part of the movement to make standard esential tools available at all license levels

IanMurray
Frequent Contributor

Thanks for posting the link, I was digging through old threads and couldn't find it, but found lots of old broken ones...

But yea, I guess its just ESRI Logic to put a tool at all license levels that is dependent on a license restricted tool to function.

0 Kudos
EricHeinrichs
Occasional Contributor

Dan, thanks for your help on this.

Is there a standalone script available for your SplitLayerByAttributes? Or, would I be able to go in and change it to work in standalone mode? 

I have some other pieces that I am trying to work into my full Python script, so I kind of need something to run completely outside of ArcMap. 

0 Kudos