# Error When Running a Python Script via Task Scheduler on Server

Question asked by geohaskett on Jan 27, 2014
Latest reply on Oct 2, 2014 by DanielaPalacios
I previously built a model using Model Builder to process some data.  The model runs fine when manually started.  However, I would like to automate the process via the task scheduler on our GIS server.  The model in question is part of a longer python script.  The script routinely failed while trying to run the model.  I therefore rewrote the script and replaced the model with python code.  Again, it runs flawlessly when I manually start it, however it now snags on the arcpy.mapping.ExportReport() portion of the code.  Below is the error message I am receiving:

[INDENT]/n/nPYTHON ERRORS:
Traceback Info:
File "C:\arcgisserver\gisData\services\eqMap\toolsNscripts\runEQAnalysis.py", line 402, in <module>
arcpy.mapping.ExportReport(lyr,rlfPath,pdfPathTemp)

Error Info:
<type 'exceptions.AttributeError'>: This functionality is not supported on server.
/n/n[/INDENT]

Why would it run flawlessly when manually triggered, but crash when triggered by the Task Scheduler?

The entire script is quite long, however below is the section its stopping at:

reportFolder = "C:/inetpub/wwwroot/flexviewers/_supportDocs/reports/" pdfPathTemp = reportFolder+"earthquakeReportTemp.pdf" rlfPath = "C:/arcgisserver/gisData/services/eqMap/toolsNscripts/agentReport.rlf" eq = policyList[0] whereClause = "EPICENTER = '"+eq+"'" lyr.definitionQuery = whereClause  arcpy.mapping.ExportReport(lyr,rlfPath,pdfPathTemp)

The policyList[0] is populated using the arcpy.da.SearchCursor() and appending the list as it reads through the attribute table.

I am using ArcGIS Server 10.2, Windows Server 2008 R2 Standard w/ SP1 and 64-bit OS.

Thanks for any guidance you can give.