Select to view content in your preferred language

Publishing .PYT as GP Service with multiple .py files

195
1
08-30-2024 06:48 AM
West-d-gis
Emerging Contributor

I am trying to figure out how to properly publish a geoprocessing tool and get it to work when published. The tool works fine in Pro and can be shared out. However, when it is shared it is only copying the .pyt file to the ArcGIS Server and it is not copying any of the required files. I am following the recommended file structure from ESRI's documentation of:

-project
--file.pyt
--file.pyt.xml
--__init__.py
--models
---required.py
---__init__.py
--utils
---utils.py
---__init__.py


However, when sharing as a GP service, nothing in the models or utils directories gets copied over.

What is the suggested best practices for publishing a geoprocessing tool that contains nested python files?

0 Kudos
1 Reply
West-d-gis
Emerging Contributor

If anyone comes across this issue in the future, here's some of things I've discovered through debugging it:

  • Publishing to ArcGIS Server 11.1 from ArcGIS Pro 3.1 does not have this issue.
  • Publishing to ArcGIS Server 11.1 from ArcGIS Pro 3.3.1 showed this issue
  • Moving all files to the same directory (no sub-directories) caused them to be moved over.

 

However, in order to move all files consistently, you must also use the import format of "Import utils." Something like "From utils import logger" will not work.

 

0 Kudos