3

I am developing a script that will be used in ArcGIS Desktop 10.2 of Standard (formerly called ArcEditor) license level and thus importing arceditor to make sure I don't use GP tools that require Advanced (formerly called ArcInfo) license level (which I have) while developing the script.

I get the ERROR 999999: Error executing function when running the script in PyScripter. As outlined in the help, one has to import arceditor before importing arcpy. When running this single line of code:

import arceditor

When executing this single line of code, I get the C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arceditor.py file open in PyScripter and it seems that it has troubles setting product (this line is highlighted):

gp.setProduct("ArcEditor")

I have tried re-opening PyScripter, same error. import arcview gives the same error. Did I get it right that one can set using Standard (formerly called ArcEditor) license while having an ArcGIS Desktop licensed with Advanced (formerly called ArcInfo) installed on the machine? If not in this way, how then?

4
  • 2
    You are sure you actually have an available ArcEditor license on the license server, and it is available to your machine, right? You cannot set a script to use a lower level of license than what you have available in the license manager. Nov 28, 2013 at 4:38
  • 1
    Aha, that is something I should have asked probably in the first place. I have only ArcInfo (aka Advanced) Single Use license on my development machine. I thought that by setting a product level in the script one can set the license level which will be used internally within the script to see if one is allowed to run a GP tool at all or with some certain paramaters. Nov 28, 2013 at 8:07
  • That rings a bell for me now too @ryandalton
    – PolyGeo
    Nov 28, 2013 at 12:17
  • So, what's the solution for the problem where I have desktop and server installed on the same machine, and I want to run a python task that requires "Spatial Analyst" extension? Because my highest level of licensing is ArcServer, the python scripts being used are "server" and determined from this file here D:\Python27\ArcGISx6410.2\Lib\site-packages\server10.2.pth (rather than desktop python set: C:\Python27\ArcGIS10.2\Lib\site-packages\desktop10.2.pth), and I'm unable to access my spatial analyst extension which is authorized, licensed, ready to go.
    – Blomster
    Apr 10, 2014 at 9:59

3 Answers 3

3

Given your updated comment, I will summarize in an answer.

From the online help section "Accessing licenses and extensions in Python":

When using an ArcGIS for Desktop Basic or Standard license, a script should set the product to Basic or Standard. Likewise, when using an Engine or EngineGeoDB license, a script should set the product to Engine or EngineGeoDB. If a license is not explicitly set, the license will be initialized based on the highest available license level the first time an ArcPy tool, function, or class is accessed... If the necessary licenses are not available, a tool fails and returns error messages. For example, if you install with an ArcGIS for Desktop Basic license, and you attempt to execute a tool that requires a Standard or Advanced license, the tool will fail.

Therefore, with arcpy you are not able to "upgrade" or "downgrade" to a different license which is unavailable to the user without getting a failure. Therefore, if you are running ANY single-use licenses on your computer, then that is the ONLY license level you will have available.

For example, if I am a developer running an ArcInfo license, wishing to distribute a tool I developed, I can only test that as an ArcInfo license. I cannot test the tool as if I were running an ArcView license. This of course can be good and bad.

  1. If you forget to (or choose not to) set an explicit license level, and you have a license manager with available ArcView, ArcEditor, & ArcInfo licenses, it will always grab the ArcInfo. In this case, you know all the tools will be available. That's good.

  2. If however, your tool requires edit permissions to an Enterprise Geodatabase, and both your AE & AI licenses are already being consumed by other users, it will grab the AV license, and of course, fail. The same cane be said for GP tools that require higher level licenses. That of course, is bad.

Ultimately, you really only need/want to set your product level if you are using a license manager, and you really want to force the script to use one of the 2 lower license levels.

1
  • I got you, Ryan. Thanks very much for the update. Was looking for a safe way to make sure I don't use any ArcInfo license functionality when developing a script tool which will be running in ArcEditor. It came to me as a surprise recently when was sorting a table (Sort) based on two fields (and that requires ArcInfo). Will read help more thoroughly! :D Nov 28, 2013 at 19:47
3

The 10.2 SetProduct help (10.1 is the same) says:

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.

and from the code example provided there it looks like you should now be using:

# Set the ArcGIS for Desktop Standard product by importing the arceditor module.
import arceditor
import arcpy

However, on my own laptop running ArcGIS 10.2 for Desktop Standard on Windows 7 SP1 (64bit) when I run the test below:

import arcview
import arcpy
print "arcview & arcpy both imported OK!"

I get the same error as you - mine is from IDLE:

Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.

================================ RESTART ================================

Traceback (most recent call last): File "C:\temp\test.py", line 1, in import arcview File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcview.py", line 18, in gp.setProduct("ArcView") RuntimeError: ERROR 999999: Error executing function.

I thought there may have been a bug in C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcview.py so I tried changing "ArcView" to "arcview", and 10.0 to 10.2 (and 10.1) and "10.0" in its code below - all without success!

import arcgisscripting

gp = arcgisscripting.create(10.0)
gp.setProduct("ArcView")

del gp

I think you have found a bug that you should report to your local Esri support.

1
  • this is exactly what I am doing (I have edited the question to be clearer). I just run import arceditor and get the execute error. Nov 27, 2013 at 11:19
0

If you don't have available license and you want to import related library (e.g if you don't have editor license but you want to import arceditor), you will get this error. I think it is a bug, so what we did is use try-catch to catch this error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.