Geoprocessing Service Error 000732

508
2
03-12-2014 07:20 AM
FlorianSimetsreiter
New Contributor II
I just published a python script as a geoprocessing service without problems. The script works on desktop perfectly.

Now i wanted to run the geoprocessing service and i get this error.

[ATTACH=CONFIG]32149[/ATTACH]

It says that the input-layer is not available or not supported.
So i just searched for that layer and i found that it exists and i can load it into ArcMap, too.
All other files the script uses have also been copied to the server.
Does someone know a solution?
0 Kudos
2 Replies
FlorianSimetsreiter
New Contributor II
the python code looks like this:

could there be a problem with the workspace?

'''
Created on 04.12.2013

@author: Sim
'''

import arcpy
import numpy as np
from collections import Counter

arcpy.env.workspace = "C:/_exchange/Geo/Test/work.gdb"

dlr = "Dienstleistungsraum"
fwr = "Forstwirtschaftlicher_Raum"

bm_fe = arcpy.GetParameterAsText(0)
bm_gn = arcpy.GetParameterAsText(1)
bm_gs = arcpy.GetParameterAsText(2)
bm_li = arcpy.GetParameterAsText(3)
bm_oe = arcpy.GetParameterAsText(4)
bm_pa = arcpy.GetParameterAsText(5)
bm_re = arcpy.GetParameterAsText(6)
bm_rf = arcpy.GetParameterAsText(7)
bm_vo = arcpy.GetParameterAsText(8)
ge_fe = arcpy.GetParameterAsText(9)
ge_gn = arcpy.GetParameterAsText(10)
ge_gs = arcpy.GetParameterAsText(11)
ge_li = arcpy.GetParameterAsText(12)
ge_oe = arcpy.GetParameterAsText(13)
ge_pa = arcpy.GetParameterAsText(14)
ge_re = arcpy.GetParameterAsText(15)
ge_rf = arcpy.GetParameterAsText(16)
ge_vo = arcpy.GetParameterAsText(17)
pv_fe = arcpy.GetParameterAsText(18)
pv_gn = arcpy.GetParameterAsText(19)
pv_gs = arcpy.GetParameterAsText(20)
pv_li = arcpy.GetParameterAsText(21)
pv_oe = arcpy.GetParameterAsText(22)
pv_pa = arcpy.GetParameterAsText(23)
pv_re = arcpy.GetParameterAsText(24)
pv_rf = arcpy.GetParameterAsText(25)
pv_vo = arcpy.GetParameterAsText(26)
wk_fe = arcpy.GetParameterAsText(27)
wk_gn = arcpy.GetParameterAsText(28)
wk_gs = arcpy.GetParameterAsText(29)
wk_li = arcpy.GetParameterAsText(30)
wk_oe = arcpy.GetParameterAsText(31)
wk_pa = arcpy.GetParameterAsText(32)
wk_re = arcpy.GetParameterAsText(33)
wk_rf = arcpy.GetParameterAsText(34)
wk_vo = arcpy.GetParameterAsText(35)


fl_bm_gs = float(bm_gs.replace(',', '.'))
fl_ge_gs = float(ge_gs.replace(',', '.'))
fl_pv_gs = float(pv_gs.replace(',', '.'))
fl_wk_gs = float(wk_gs.replace(',', '.'))

bm_ges = []
ge_ges = []
pv_ges = []
wk_ges = []

bms = [bm_fe, bm_gn, bm_ges, bm_li, bm_oe, bm_pa, bm_re, bm_rf, bm_vo]
ges = [ge_fe, ge_gn, ge_ges, ge_li, ge_oe, ge_pa, ge_re, ge_rf, ge_vo]
pvs = [pv_fe, pv_gn, pv_ges, pv_li, pv_oe, pv_pa, pv_re, pv_rf, pv_vo]
wks = [wk_fe, wk_gn, wk_ges, wk_li, wk_oe, wk_pa, wk_re, wk_rf, wk_vo]


bm_lists = []
ge_lists = []
pv_lists = []
wk_lists = []

dlr_rows = arcpy.SearchCursor(dlr)
fwr_rows = arcpy.SearchCursor(fwr)

dlr_fields = arcpy.ListFields(dlr)
fwr_fields = arcpy.ListFields(fwr)

dlr_lists = []
fwr_lists = []

dlr_zuws = []
fwr_zuws = []

gest_k = (8.35, 11.45, 12, 13.55, 17.3, 19.8, 21.04, 22.84, 27, 27.04, 30.13, 30.78, fl_bm_gs, fl_ge_gs, fl_pv_gs, fl_wk_gs)

mean_gest_k = np.mean(gest_k)
std_gest_k = np.std(gest_k)

if fl_bm_gs < mean_gest_k - std_gest_k:
    bm_ges = "gut"
elif fl_bm_gs >= mean_gest_k - std_gest_k and fl_bm_gs < mean_gest_k:
    bm_ges = "gut"
elif fl_bm_gs >= mean_gest_k and fl_bm_gs < mean_gest_k + std_gest_k:
    bm_ges = "mittel"
else:
    bm_ges = "schlecht"

if fl_ge_gs < mean_gest_k - std_gest_k:
    ge_ges = "gut"
elif fl_ge_gs >= mean_gest_k - std_gest_k and fl_ge_gs < mean_gest_k:
    ge_ges = "gut"
elif fl_ge_gs >= mean_gest_k and fl_ge_gs < mean_gest_k + std_gest_k:
    ge_ges = "mittel"
else:
    ge_ges = "schlecht"
   
if fl_pv_gs < mean_gest_k - std_gest_k:
    pv_ges = "gut"
elif fl_pv_gs >= mean_gest_k - std_gest_k and fl_pv_gs < mean_gest_k:
    pv_ges = "gut"
elif fl_pv_gs >= mean_gest_k and fl_pv_gs < mean_gest_k + std_gest_k:
    pv_ges = "mittel"
else:
    pv_ges = "schlecht"   

if fl_wk_gs < mean_gest_k - std_gest_k:
    wk_ges = "gut"
elif fl_wk_gs >= mean_gest_k - std_gest_k and fl_wk_gs < mean_gest_k:
    wk_ges = "gut"
elif fl_wk_gs >= mean_gest_k and fl_wk_gs < mean_gest_k + std_gest_k:
    wk_ges = "mittel"
else:
    wk_ges = "schlecht"




for bm in bms:
    if bm == "gut":
        bm_lists.append(3)
    elif bm == "mittel":
        bm_lists.append(2)
    else:
        bm_lists.append(1)
   
for ge in ges:
    if ge == "gut":
        ge_lists.append(3)
    elif ge == "mittel":
        ge_lists.append(2)
    else:
        ge_lists.append(1)

for pv in pvs:
    if pv == "gut":
        pv_lists.append(3)
    elif pv == "mittel":
        pv_lists.append(2)
    else:
        pv_lists.append(1)
       
for wk in wks:
    if wk == "gut":
        wk_lists.append(3)
    elif wk == "mittel":
        wk_lists.append(2)
    else:
        wk_lists.append(1)   

  


for dlr_row in dlr_rows:
    for dlr_field in dlr_fields:
        if dlr_field.type == "SmallInteger":
            dlr_lists.append(dlr_row.getValue(dlr_field.name))
                   
for fwr_row in fwr_rows:
    for fwr_field in fwr_fields:
        if fwr_field.type == "SmallInteger":
            fwr_lists.append(fwr_row.getValue(fwr_field.name))


for bm_list, dlr_list in zip(bm_lists, dlr_lists):
        if bm_list >= dlr_list:
            dlr_zuws.append("Biomasse")

for ge_list, dlr_list in zip(ge_lists, dlr_lists):
        if ge_list >= dlr_list:
            dlr_zuws.append("Geothermie")
           
for pv_list, dlr_list in zip(pv_lists, dlr_lists):
        if pv_list >= dlr_list:
            dlr_zuws.append("Photovoltaik")

for wk_list, dlr_list in zip(wk_lists, dlr_lists):
        if wk_list >= dlr_list:
            dlr_zuws.append("Windkraft")


for bm_list, fwr_list in zip(bm_lists, fwr_lists):
        if bm_list >= fwr_list:
            fwr_zuws.append("Biomasse")

for ge_list, fwr_list in zip(ge_lists, fwr_lists):
        if ge_list >= fwr_list:
            fwr_zuws.append("Geothermie")
           
for pv_list, fwr_list in zip(pv_lists, fwr_lists):
        if pv_list >= fwr_list:
            fwr_zuws.append("Photovoltaik")

for wk_list, fwr_list in zip(wk_lists, fwr_lists):
        if wk_list >= fwr_list:
            fwr_zuws.append("Windkraft")


count_dlr = Counter(dlr_zuws)
count_fwr = Counter(fwr_zuws)


count_dlr_value = max(count_dlr.values())
count_dlr_result = [key for key, value in count_dlr.iteritems() if value == count_dlr_value ]         

count_fwr_value = max(count_fwr.values())
count_fwr_result = [key for key, value in count_fwr.iteritems() if value == count_fwr_value ]


dlr_energy = ', '.join(count_dlr_result)
fwr_energy = ', '.join(count_fwr_result)


with arcpy.da.UpdateCursor(dlr, "Energieform") as cursor:
    for row in cursor:
        row[0] = dlr_energy
        cursor.updateRow(row)

with arcpy.da.UpdateCursor(fwr, "Energieform") as cursor:
    for row in cursor:
        row[0] = fwr_energy
        cursor.updateRow(row)


dlr_checks = arcpy.SearchCursor(dlr)
fwr_checks = arcpy.SearchCursor(fwr)



for dlr_check in dlr_checks:
    if dlr_check.getValue("Energieform") == "Windkraft":
        arcpy.ApplySymbologyFromLayer_management("Dienstleistungsraum", "C:/_exchange/Geo/Test/Symbology/wk.lyr")
    elif dlr_check.getValue("Energieform") == "Windkraft, Photovoltaik":
        arcpy.ApplySymbologyFromLayer_management("Dienstleistungsraum", "C:/_exchange/Geo/Test/Symbology/wk_pv.lyr")
    elif dlr_check.getValue("Energieform") == "Photovoltaik":
        arcpy.ApplySymbologyFromLayer_management("Dienstleistungsraum", "C:/_exchange/Geo/Test/Symbology/pv.lyr")
  


for fwr_check in fwr_checks:
    if fwr_check.getValue("Energieform") == "Windkraft":
        arcpy.ApplySymbologyFromLayer_management("Forstwirtschaftlicher_Raum", "C:/_exchange/Geo/Test/Symbology/wk.lyr")
    elif fwr_check.getValue("Energieform") == "Windkraft, Photovoltaik":
        arcpy.ApplySymbologyFromLayer_management("Forstwirtschaftlicher_Raum", "C:/_exchange/Geo/Test/Symbology/wk_pv.lyr")
    elif fwr_check.getValue("Energieform") == "Photovoltaik":
        arcpy.ApplySymbologyFromLayer_management("Forstwirtschaftlicher_Raum", "C:/_exchange/Geo/Test/Symbology/pv.lyr")
   
0 Kudos
ShingLin
Esri Contributor
Setting work space is fine. The problem looks like in the usage of the tool ApplySymbologyFromLayer.

The first parameter of ApplySymbologyFromLayer you use is a feature class and the second parameter is a layer. That will only work
f running the script from Python Windows on Desktop, ist that the case? If not, I am surprised how it works from Stand-alone script (like from Catalog script tool or IDE) since both parameters should be layer running from either environment.

If you want to run the script in the stand-alone environment, the right way is to make both parameters of the tool as layer and publishing as a service. Then the serice will work. Let me know if this helps.

Regards,

Shing
0 Kudos