I am trying to publish a web tool from ModelBuilder in ArcGIS Pro. Inside my model there is (besides other things) a script. This script works with data on the same Portal that I want to publish the Webtool to. Consequently, I need to create a connection to the Portal inside the script.

gis = GIS(url="https://***/portal", username="***", password="***?", verify_cert=False)

The model works fine in ArcGIS Pro, the script does what I want, it applies some edits to data on Portal. However, when trying to publish the layer as a webtool, I always get an error message:

Error 00068: Script contains broken project data source

enter image description here

It seems that the problem is the connection to my Portal in the script. Is there any way to avoid that? I tried using a token instead of credentials, but the result is the same.

EDIT: Added error description

  • Error messages should always be included as text, since images are not legible on all devices or searchable
    – Vince
    Commented Aug 18, 2022 at 11:51

1 Answer 1


As answered here you should do some trick with portal url. GP publishing tool is confused when parses the script for files paths

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

gis = GIS(url = portalURL, username = 'geop', password = '****', verify_cert = False)

I made it like this:

from urllib.parse import urlunparse
portal_url = urlunparse(('https', 'geoportal.domain.com', 'portal', None, None, None)). #'https://geoportal.domain.com/portal'
  • Thanks for the tip. That worked for me
    – Martin
    Commented Jul 26, 2023 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.