MadsGren

openpyxl process error 816 from arcgis server

Discussion created by MadsGren on Oct 5, 2012
Hi
I'm trying to create a GP-service that uses the python openpyxl 3. party module.
When i'm running it from arcmap(Standard), it works like a charm, publich the result as gp-service on the server.
When i then sets up the flexviewer 3.0 using the gp-widget - i get an error 000816 tool is not valid, and nothing else.

import osimport arcpy
import uuid
import openpyxl


class Toolbox(object):
    def __init__(self):
        """Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""
        self.label = "Toolbox"
        self.alias = ""


        # List of tool classes associated with this toolbox
        self.tools = [Tool]




class Tool(object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Tool"
        self.description = ""
        self.canRunInBackground = False


    def getParameterInfo(self):
        """Define parameter definitions"""


        param0 = arcpy.Parameter(
        displayName="FileName",
        name="filename",
        datatype="String",
        parameterType="Required",
        direction="Input")
    param0.value = 'OpenPyXl'
    params = [param0]
        return params


    def isLicensed(self):
        """Set whether tool is licensed to execute."""
        return True


    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""
        return


    def updateMessages(self, parameters):
        """Modify the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""
        return


    def execute(self, parameters, messages):
        """The source code of the tool."""
    wb = openpyxl.Workbook(optimized_write=True)
        ws = wb.create_sheet() 
    wb_file = r'C:\arcgisserver\directories\arcgisoutput\_ags_' + str(uuid.uuid4()) + '_' + parameters[0].value + '.xlsx'
##    arcpy.AddMessage(wb_file)
        wb.save(wb_file)




this is the python toolbox i'm trying to publish, it's quite simple, the  only thing it does is making a xlsx file in the   c:\arcgisserver\directories\arcgisoutput folder with the name  _ags_UUID_OpenPyXl.xlsx

The output folder is set up in the Datastore on the server.
I've tried to copy the openpyxl folder from the python folder to the same folder as the python toolbox, no luck at that.
I've tried to add a sys.path.append and the path to the openpyxl folder, no luck at that.

somebody please help me, my larger tool wont work before i've solved this problem.

Outcomes