<?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: arcpy Script works as standalone, but not when published to arcgis server in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-script-works-as-standalone-but-not-when/m-p/641496#M49999</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is a known bug dealing with the XSLTransform_conversion command.&amp;nbsp; It runs from a model but not when exporting to a script.&amp;nbsp; Two ESRI DLLs must be installed on each PC that runs the script.&amp;nbsp; I don't have the bug number handy but can look it up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jan 2012 23:18:53 GMT</pubDate>
    <dc:creator>RandyKreuziger</dc:creator>
    <dc:date>2012-01-31T23:18:53Z</dc:date>
    <item>
      <title>arcpy Script works as standalone, but not when published to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-works-as-standalone-but-not-when/m-p/641495#M49998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing an arcpy script to export metadata from my arcsde. When I run it as a publish it to my arcgis server the scrip runs but does not export any metadata.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import os
import shutil
import arcpy
import arcpy.mapping
import arcgisscripting
from arcpy import env

dir = arcpy.GetInstallInfo("desktop")["InstallDir"]
xslt = dir + "Metadata/Stylesheets/ArcGIS.xsl"
translator = dir +&amp;nbsp; "Metadata/Translator/ESRI_ISO2ISO19139.xml"

#service = arcpy.GetParameterAsText(0)
service = "grace"
workDir = r"c:/temp/"+service
if not os.path.exists(workDir):
 os.makedirs(workDir)
else:
 shutil.rmtree(workDir)
 os.makedirs(workDir)
env.workspace = workDir
mxd = arcpy.mapping.MapDocument(r"D:\\arcGisSupportFiles\\ServerMaps\\"+service+".mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
 try:
&amp;nbsp; if(lyr.datasetName.split(".")[0] == "sde"):
&amp;nbsp;&amp;nbsp; arcpy.XSLTransform_conversion(lyr, xslt, lyr.name+".html", "#")
&amp;nbsp;&amp;nbsp; #arcpy.ESRITranslator_conversion (lyr, translator, lyr.name+".html", "#")
&amp;nbsp;&amp;nbsp; print "sde layer, metadata created"
&amp;nbsp; else:
&amp;nbsp;&amp;nbsp; print "non-sde layer, no metadata to create"
 except:
&amp;nbsp; print "folder layer"
metaDir = "\\\\gisv\\kyle\\metadata\\"+service
if os.path.exists(metaDir):
 shutil.rmtree(metaDir)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 15:55:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-works-as-standalone-but-not-when/m-p/641495#M49998</guid>
      <dc:creator>KyleChouinard</dc:creator>
      <dc:date>2012-01-12T15:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy Script works as standalone, but not when published to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-works-as-standalone-but-not-when/m-p/641496#M49999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is a known bug dealing with the XSLTransform_conversion command.&amp;nbsp; It runs from a model but not when exporting to a script.&amp;nbsp; Two ESRI DLLs must be installed on each PC that runs the script.&amp;nbsp; I don't have the bug number handy but can look it up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 23:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-works-as-standalone-but-not-when/m-p/641496#M49999</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2012-01-31T23:18:53Z</dc:date>
    </item>
  </channel>
</rss>

