Noodles484

Script works in ArcMap, won't publish to ArcServer

Discussion created by Noodles484 on Feb 7, 2013
Latest reply on Feb 8, 2013 by Noodles484
Hi,  I wrote a python script, wrapped it in ModelBuilder and tried to publish it.  It just gets stuck in a loop, forcing me to cancel the publish.  It passed the analysis and all the data used in it is in verified folders in the ArcServer data sources.  I can't figure out what's going on.  I've tried publishing it from ArcMap on both my desktop computer and on the server itself, but get the same error.  The error is 001270 Consolidating the data failed.  I followed all steps listed in the help for that error and it didn't work.  I'm out of ideas, can someone look at this code and figure out why it won't publish?  My only guess is it has to do with some sort of temporary data, possible the %scratchFolder%, although unlikely.  My other thought is one of the import scripts is giving some errors. 

The code takes a feature class, email information, and the %scratchFolder% variable.  It creates a NobelTec file (which is just a simple text file in the open navigation format) and a csv of the feature class's table, then zips the two new files and the feature class together, and emails the end user.  Pretty simple and works fine from ArcMap.  Most of it is code from the ArcToolBox that I took and hard-coded some things and deleted unnecessary parts.   I exported the ModelBuilder code to python and will show that first, then show the python script tool itself.  (Note that I replaced email addresses, folder locations, and server info with dummy info, but have them written out on my copy.)  Any help would be GREATLY appreciated!

Due to text length issues, the python code for the script will be posted in the first reply.

Exported ModelBuilder code:
import arcpy
arcpy.ImportToolbox("//XXX.XXX.XXX.XXX/arcData/lab_data/FOLDER1/FOLDER2/MyToolBox10_1.tbx")

jobID = arcpy.GetParameterAsText(0)
if jobID == '#' or not jobID:
    jobID = "\\\\XXX.XXX.XXX.XXX\\arcData\\lab_data\\FOLDER1\\FOLDER2\\ToolData\\SaveAndEmail.gdb\\Stations"

Output_File_Name = arcpy.GetParameterAsText(1)
if Output_File_Name == '#' or not Output_File_Name:
    Output_File_Name = "BTS_2013_Spring"

Email_To = arcpy.GetParameterAsText(2)
if Email_To == '#' or not Email_To:
    Email_To = "EndUserEmail@WhereEver.com"

Email_Subject = arcpy.GetParameterAsText(3)
if Email_Subject == '#' or not Email_Subject:
    Email_Subject = "BTS_2013_Spring_Stations"

Email_Body = arcpy.GetParameterAsText(4)
if Email_Body == '#' or not Email_Body:
    Email_Body = "Here are your stations"

Worked = arcpy.GetParameterAsText(5)

Input_Stations = "%jobID%"
Scratch_Folder = "%scratchFolder%"

arcpy.gp.toolbox = "//XXX.XXX.XXX.XXX/arcData/lab_data/FOLDER1/FOLDER2/MyToolBox10_1.tbx";
arcpy.gp.CreateFilesZipAndEmail(Input_Stations, Scratch_Folder, Output_File_Name, Email_To, Email_Subject, Email_Body)

Outcomes