Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
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. –  RyanDalton Nov 28 '13 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. –  Alex Tereshenkov Nov 28 '13 at 8:07
    
That rings a bell for me now too @ryandalton –  PolyGeo Nov 28 '13 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 at 9:59

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
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 –  Alex Tereshenkov Nov 28 '13 at 19:47

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.

share|improve this answer
    
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. –  Alex Tereshenkov Nov 27 '13 at 11:19
    
thanks for testing that, appreciated! –  Alex Tereshenkov Nov 28 '13 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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