<?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: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why. in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109483#M4330</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I found was that I had to have some sort of input for the geoprocessing service to work.&amp;nbsp; Once I created an input, the service worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Sep 2015 17:51:07 GMT</pubDate>
    <dc:creator>JustinJacobs</dc:creator>
    <dc:date>2015-09-17T17:51:07Z</dc:date>
    <item>
      <title>I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109476#M4323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a python script that works.&amp;nbsp; I've put it into a toolbox, run it and it works.&amp;nbsp; I make it into a geoprocessing service and it fails.&amp;nbsp; I cannot figure out why. The script pulls up a data driven page mxd, creates the mapbook, exports it as a pdf.&amp;nbsp; I don't understand why the geoprocessing service doesn't work.&amp;nbsp; It fails.&amp;nbsp; Does anyone have an idea as to why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 13:57:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109476#M4323</guid>
      <dc:creator>JustinJacobs</dc:creator>
      <dc:date>2014-08-12T13:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109477#M4324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please post some more information:&lt;/P&gt;&lt;P&gt;-the exact error message (turn message level to INFO at the gp service level and run it again from Desktop to get the error messages&lt;/P&gt;&lt;P&gt;-possibly post your script&lt;/P&gt;&lt;P&gt;-have you registered your MXD folder with the datastore? You dont have to, but in this case its probably a good idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 14:58:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109477#M4324</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2014-08-12T14:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109478#M4325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've registered all the data sources with the server.&amp;nbsp; It's like I said, the script executes from toolbox without issues. It's only after becoming a service that it fails.&amp;nbsp; The service is Asynchronous.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My error message just says: Failed.&amp;nbsp; &lt;IMG alt="failed.gif" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/3412_failed.gif" style="width: 620px; height: 173px;" /&gt;&lt;/P&gt;&lt;P&gt;Here is the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy,os,uuid,datetime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#path to template mxds&lt;/P&gt;&lt;P&gt;mxdPath = r"C:\regional_service_data\Cook\Mapbooks\ElectricUtilitiesMapbook.mxd"&lt;/P&gt;&lt;P&gt;titleMXD = r"C:\regional_service_data\Cook\Mapbooks\ElectricUtilitiesIndexPage.mxd"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Build PDF File Name&lt;/P&gt;&lt;P&gt;pdfFileName = "ElecMap_" + str(uuid.uuid4()) + ".pdf"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;outputPath = arcpy.env.scratchWorkspace&lt;/P&gt;&lt;P&gt;if not outputPath:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputPath = r"C:\arcgisserver\directories\arcgisoutput"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OutputFile = os.path.join(outputPath, pdfFileName)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Creating Title Page...")&lt;/P&gt;&lt;P&gt;#open title page mxd and set title text&lt;/P&gt;&lt;P&gt;titlePage = arcpy.mapping.MapDocument(titleMXD)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#export title page to pdf - well use to append to the ddp pdf&lt;/P&gt;&lt;P&gt;tempTitlePDFPath = os.path.join(outputPath,"titlePage.pdf")&lt;/P&gt;&lt;P&gt;arcpy.mapping.ExportToPDF(titlePage, tempTitlePDFPath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;del titlePage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Reference the map document&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Initializing MapBook...")&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument(mxdPath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#reference the DataDrivenPages&lt;/P&gt;&lt;P&gt;ddp = mxd.dataDrivenPages&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#export DDP to pdf&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Exporting PDF...")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ddp.exportToPDF(OutputFile,"ALL","","PDF_SINGLE_FILE",300,"FASTER","RGB",True,"ADAPTIVE","RASTERIZE_BITMAP",True,"NONE",True,80)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("PDF Created")&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Appending Pages")&lt;/P&gt;&lt;P&gt;#ddp index and title pages&lt;/P&gt;&lt;P&gt;finalPDF = arcpy.mapping.PDFDocumentOpen(OutputFile)&lt;/P&gt;&lt;P&gt;finalPDF.insertPages(tempTitlePDFPath,1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Saving PDF")&lt;/P&gt;&lt;P&gt;finalPDF.saveAndClose()&lt;/P&gt;&lt;P&gt;#make outputfile available to gp clients&lt;/P&gt;&lt;P&gt;arcpy.SetParameterAsText(0, OutputFile)&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Cleaning Up")&lt;/P&gt;&lt;P&gt;#Clean up&lt;/P&gt;&lt;P&gt;del mxd&lt;/P&gt;&lt;P&gt;del finalPDF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;os.remove(tempTitlePDFPath)&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("Done")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2014 15:55:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109478#M4325</guid>
      <dc:creator>JustinJacobs</dc:creator>
      <dc:date>2014-08-13T15:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109479#M4326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would try republishing the GP tool with logging at the info level and repost the error with the additional detail. I had a similar problem where I had a 3rd party module that wasn't installed in the 64bit python folder on each of the servers.&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000005v9000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000005v9000000"&gt;ArcGIS Help 10.1&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 14:15:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109479#M4326</guid>
      <dc:creator>JoshuaPust</dc:creator>
      <dc:date>2014-08-14T14:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109480#M4327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is you server on the same machine which you have desktop on? The reason why I ask is that you have a couple of paths to your c:\ eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\regional_service_data\Cook\Mapbooks\ElectricUtilitiesMapbook.mxd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can your server see the same path?&amp;nbsp; Try using a UNC path to the same area in your python script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 14:20:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109480#M4327</guid>
      <dc:creator>AnthonyGiles</dc:creator>
      <dc:date>2014-08-14T14:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109481#M4328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These two lines stand out to me right away:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxdPath = r"C:\regional_service_data\Cook\Mapbooks\ElectricUtilitiesMapbook.mxd"&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; titleMXD = r"C:\regional_service_data\Cook\Mapbooks\ElectricUtilitiesIndexPage.mxd"&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Server cannot access directories unless you register them.&amp;nbsp; Instead of hard coding them make them input parameters and let server copy the map documents to where it puts the GP data.&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Your tool probably cannot access the mxds.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Hope this helps.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 18:18:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109481#M4328</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2014-08-14T18:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109482#M4329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had this same problem with one of the ESRI samples and when I made it Synchronous it worked fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 21:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109482#M4329</guid>
      <dc:creator>Hernando_CountyProperty_Apprai</dc:creator>
      <dc:date>2014-08-14T21:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: I have a python script that works.  I've put it into a toolbox, run it and it works.  I make it into a geoprocessing service and it fails.  I cannot figure out why.</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109483#M4330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I found was that I had to have some sort of input for the geoprocessing service to work.&amp;nbsp; Once I created an input, the service worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2015 17:51:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/i-have-a-python-script-that-works-i-ve-put-it-into/m-p/109483#M4330</guid>
      <dc:creator>JustinJacobs</dc:creator>
      <dc:date>2015-09-17T17:51:07Z</dc:date>
    </item>
  </channel>
</rss>

