Hello there
Normally, it should be possible to create a geoprocessing-service which creates a text file with the script below:
import os
# input variable of type String
input_from_client = str(arcpy.GetParameterAsText(0))
file_path = os.path.join(arcpy.env.packageWorkspace, "test.txt")
text_file = open(file_path,"w")
text_file.write(input_from_client)
text_file.close()
# Output variable of type file
arcpy.SetParameter(1, text_file.name)
A service created with the above code can be published without problems to ArcGIS Server 10.6.1 But when I try to publish the same service on a Machine with ArcGIS Server 10.7.1, I get the following error(s):
WARNING 15 Oct 2020 14:51:50 Thumbnail is not avaliable on this layer Conservation_forest_province Rest
SEVERE 15 Oct 2020 14:51:43 Error executing tool. PublishServiceDefinition Job ID: j323c6e9585524bc7973f7b1cd3f948f8 : ERROR 001369: Failed to create the service. Failed to execute (Publish Service Definition). Failed. Failed to execute (Publish Service Definition). System/PublishingTools.GPServer
SEVERE 15 Oct 2020 14:51:43 Delegate job failed. System/PublishingTools.GPServer
SEVERE 15 Oct 2020 14:51:41 Error executing tool. PublishServiceDefinition Job ID: j267b052ffdcd47e5bcda9064e9e151df : ERROR 001369: Failed to create the service. Failed to execute (Publish Service Definition). System/PublishingToolsEx.GPServer
SEVERE 15 Oct 2020 14:51:41 Failed to create the service. System/PublishingToolsEx.GPServer
SEVERE 15 Oct 2020 14:51:41 Failed generating the service definition name mapping. System/PublishingToolsEx.GPServer
SEVERE 15 Oct 2020 14:51:41 Failed to add the dbMapping object. System/PublishingToolsEx.GPServer
SEVERE 15 Oct 2020 14:51:41 Failed to add the dsMapping object. System/PublishingToolsEx.GPServer
SEVERE 15 Oct 2020 14:51:41 Invalid manifest. Unable to find dataset in extracted geodatabase. System/PublishingToolsEx.GPServer
WARNING 15 Oct 2020 14:51:29 Metadata is not avaliable on this layer Conservation_forest_province Rest
Any idea what I can try to make it work on the 10.7.1 Server as well? Is it possible that I have to define the file path differently?
I would be very thankful for help or advise.
Solved! Go to Solution.
Apparently, arcpy.env.packageWorkspace is not the ideal way to define tool output folders, I used arcpy.env.scratchFolder instead:
import arcpy
import os
input_from_client = str(arcpy.GetParameterAsText(0))
file_path = os.path.join(arcpy.env.scratchFolder, "test.txt")
text_file = open(file_path,"w")
text_file.write(input_from_client)
text_file.close()
arcpy.SetParameter(1, text_file.name)
That does not fix the 001369 Error though. The solution for me was
1. Create a new Project
2. Create a new Script in the Project's toolbox which uses the above script.
Then, it was possible to publish the service successfully
Apparently, arcpy.env.packageWorkspace is not the ideal way to define tool output folders, I used arcpy.env.scratchFolder instead:
import arcpy
import os
input_from_client = str(arcpy.GetParameterAsText(0))
file_path = os.path.join(arcpy.env.scratchFolder, "test.txt")
text_file = open(file_path,"w")
text_file.write(input_from_client)
text_file.close()
arcpy.SetParameter(1, text_file.name)
That does not fix the 001369 Error though. The solution for me was
1. Create a new Project
2. Create a new Script in the Project's toolbox which uses the above script.
Then, it was possible to publish the service successfully