import arcserver fail when desktop is installed and has no license

2220
2
06-15-2016 05:03 AM
ModyBuchbinder
Esri Regular Contributor

Hi all

I am running into a strange problem with Python on my machine.

I have desktop and server (10.3.1) installed on my machine.

In many cases I have no free license for desktop (using floating license).

So my first line in the script is "import arcserver"

This line works when desktop license is available (but does not take a desktop license).

You can see the error message in the screen shot.

When the desktop license available it runs with no errors.

I printed the sys.path in the screen shot, you can see that some desktop paths are still in the path, it must run some python modules from there and fail.

I found a work around, I recreate the sys.path without any item that contain the string "Desktop" but it still looks as a bug.

Anybody runs into this?

Thanks

0 Kudos
2 Replies
AhmedEl-Sisi
Occasional Contributor III

Check the following posts, it may help.

Error: ArcPy fails to import on a machine authorized for ArcGIS Server

arcgis desktop - arcpy license: import arcserver is ignored at 10.3.1 - Geographic Information Syste...

ArcGIS Desktop and ArcGIS Server lay down separate installs of the ArcPy module in their respective install locations. In addition, ArcGIS Desktop and ArcGIS Server place unique path configuration files (desktop.pth and server.pth) in the Lib\site-packages folder of the install location for Python.

• Desktop.pth contains the path to the ArcGIS Desktop install for ArcPy.
• Server.pth contains the path to the ArcGIS Server install for ArcPy.

When ArcPy is imported as a result of the process described above, the path to the ArcGIS Desktop install of ArcPy is found first. When it is imported it attempts to find a license for ArcGIS Desktop and fails with the exception shown above.

ModyBuchbinder
Esri Regular Contributor

Hi Ahmed

My solution is similar and looks like this:

newPath = []

for p in sys.path:

     if(p.find("Desktop") == -1): newPath.append(p)

sys.path = newPath

Adding these few lines into the python code save the need to change the desktop.pth and let the desktop keep working with python.

Mody