<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Arcgis server 10.1 and openpyxl error 816 in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490927#M16408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to have the 3rd party module installed on your server, and you need to ensure it's the 64-bit version.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Server using python 2.7 64-bit where as the desktop version uses the 32-bit version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See: &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2012/09/06/a-simple-approach-for-including-3rd-party-python-libraries-with-your-scripts/"&gt;http://blogs.esri.com/esri/arcgis/2012/09/06/a-simple-approach-for-including-3rd-party-python-libraries-with-your-scripts/&lt;/A&gt;&lt;SPAN&gt; for some help with this issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Oct 2012 10:23:12 GMT</pubDate>
    <dc:creator>AndrewChapkowski</dc:creator>
    <dc:date>2012-10-05T10:23:12Z</dc:date>
    <item>
      <title>Arcgis server 10.1 and openpyxl error 816</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490924#M16405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to create a GP-service that uses the python openpyxl 3. party module.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When i'm running it from arcmap(Standard), it works like a charm, publich the result as gp-service on the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import osimport arcpy
import uuid
import openpyxl


class Toolbox(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Define the toolbox (the name of the toolbox is the name of the
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .pyt file)."""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.label = "Toolbox"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.alias = ""


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # List of tool classes associated with this toolbox
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.tools = [Tool]




class Tool(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Define the tool (tool name is the name of the class)."""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.label = "Tool"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.description = ""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.canRunInBackground = False


&amp;nbsp;&amp;nbsp;&amp;nbsp; def getParameterInfo(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Define parameter definitions"""


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; param0 = arcpy.Parameter(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; displayName="FileName",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="filename",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datatype="String",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameterType="Required",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; direction="Input")
&amp;nbsp;&amp;nbsp;&amp;nbsp; param0.value = 'OpenPyXl'
&amp;nbsp;&amp;nbsp;&amp;nbsp; params = [param0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return params


&amp;nbsp;&amp;nbsp;&amp;nbsp; def isLicensed(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Set whether tool is licensed to execute."""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return True


&amp;nbsp;&amp;nbsp;&amp;nbsp; def updateParameters(self, parameters):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Modify the values and properties of parameters before internal
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; validation is performed.&amp;nbsp; This method is called whenever a parameter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; has been changed."""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return


&amp;nbsp;&amp;nbsp;&amp;nbsp; def updateMessages(self, parameters):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Modify the messages created by internal validation for each tool
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameter.&amp;nbsp; This method is called after internal validation."""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return


&amp;nbsp;&amp;nbsp;&amp;nbsp; def execute(self, parameters, messages):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """The source code of the tool."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; wb = openpyxl.Workbook(optimized_write=True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ws = wb.create_sheet() 
&amp;nbsp;&amp;nbsp;&amp;nbsp; wb_file = r'C:\arcgisserver\directories\arcgisoutput\_ags_' + str(uuid.uuid4()) + '_' + parameters[0].value + '.xlsx'
##&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(wb_file)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wb.save(wb_file)


&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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&amp;nbsp; c:\arcgisserver\directories\arcgisoutput folder with the name _ags_UUID_OpenPyXl.xlsx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The output folder is set up in the Datastore on the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried to copy the openpyxl folder from the python folder to the same folder as the python toolbox, no luck at that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried to add a sys.path.append and the path to the openpyxl folder, no luck at that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;somebody please help me, my larger tool wont work before i've solved this problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 20:17:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490924#M16405</guid>
      <dc:creator>LemvigKommune</dc:creator>
      <dc:date>2012-10-04T20:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Arcgis server 10.1 and openpyxl error 816</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490925#M16406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Change the wb_file parameter to use the arcpy.env.scratchFolder instead of hard coding the directory.&amp;nbsp; GP tools when fired off from server create a temp directory for each job, and you want to do your work there.&amp;nbsp; Then you would use arcpy.SetParameterAsText or arcpy.SetParameter() to return the results back to the end user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# change
wb_file = r'C:\arcgisserver\directories\arcgisoutput\_ags_' + str(uuid.uuid4()) + '_' + parameters[0].value + '.xlsx'
# to
wb_file = env.scratchFolder + os.sep + "myfilename.xlsx"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490925#M16406</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-11T21:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Arcgis server 10.1 and openpyxl error 816</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490926#M16407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Andrew, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That didn't work, I've come as far as to think it has something to do with the 3. party module, openpysl.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think it gets imported when the tool runs from the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mads&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 10:04:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490926#M16407</guid>
      <dc:creator>LemvigKommune</dc:creator>
      <dc:date>2012-10-05T10:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Arcgis server 10.1 and openpyxl error 816</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490927#M16408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to have the 3rd party module installed on your server, and you need to ensure it's the 64-bit version.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Server using python 2.7 64-bit where as the desktop version uses the 32-bit version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See: &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2012/09/06/a-simple-approach-for-including-3rd-party-python-libraries-with-your-scripts/"&gt;http://blogs.esri.com/esri/arcgis/2012/09/06/a-simple-approach-for-including-3rd-party-python-libraries-with-your-scripts/&lt;/A&gt;&lt;SPAN&gt; for some help with this issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 10:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcgis-server-10-1-and-openpyxl-error-816/m-p/490927#M16408</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2012-10-05T10:23:12Z</dc:date>
    </item>
  </channel>
</rss>

