Problem: Data source used by script is not registered with the server and will be copied


Attempts to share a script as a web tool with the arcgis.gis module in a geoprocessing service in ArcGIS Pro return the following warning:

Data source used by script is not registered with the server and will be copied
The image of the Warning message

The warning message is returned when analyzing the service before publishing.

A geoprocessing service using the arcgis.gis module executes the same request to ArcGIS REST API. However, using a geoprocessing service creates additional overhead as a result of hosting the service and system resource usage.

Example of an arcgis.gis module (script):

kml_content = gis.content.search("*", item_type="KML")

Example of an ArcGIS REST API request:

Request Type: POST https://hostname.domain.com/portal/sharing/rest/search HTTP/1.1
Format: json
Query: q * AND  (type:"kml") accountid:0123456789ABCDEF


When analyzing a geoprocessing service, the script is scanned to discover any project data. Every quoted string used in a Python variable or as an argument to a function is tested to identify if it is a path to existing data.

If a geoprocessing service contains a script using a function from the arcgis.gis module, string variables can be interpreted as a file path instead of a URL. As the string variable is not a valid file path, the analyzer returns the warning message. The warning prevents the publishing of the geoprocessing service because a 00068 error is also returned. The URL is considered a broken data source and this renders the system unable to copy the source to the server.

The following script demonstrates a connection to the portal. When the analyzer scans the script, it interprets the portal URL as a file path.

gis = GIS("https://hostname.domain.com/portal","portaladmin","portaladmin1")

Solution or Workaround

To publish a geoprocessing service using Python, it is necessary for the analyzer not to interpret string parameters as a data source. This can be prevented by replacing the "//" or "/" string with a different symbol, for example, "??" or "?", and using the replace() method to return the proper URL. The following code demonstrates how this is performed:

portalURL = "https??hostname.domian.com?portal"
portalURL = portalURL.replace('??', '://')
portalURL = portalURL.replace('?', ':/')
gis = GIS(portalURL)

Related Information