When publishing a geoprocessing service, I noticed that arcgis does not like to see:
os.path.join(os.path.dirname(__file__), 'projections')
This line seems to throw an broken project data source while analyzing the service for publishing to arcgis server.
I'm guessing its because the only the main .py file will be copied into the services directory and Esri is giving me a heads up that the data source is going to break because 'projections' folder will NOT be copied over.
In my case, I also have some unit test which reference a test_data folder and shouldn't affect the tool when running off the server. Unfortunately I still can't publish.
To publish, I:
- Moved my relative path references to a separate module named service_config.py
- imported the path constants from service_config.py
- Added a .pth file to Lib/site-packages to allow the services directory version of the script to still have references to the projection folder without needing it to be copied to the arcgisinput directory.
I feel like my solution is a hack. Any suggests on how to improve this tool configuration?
My code can be found here: