We have a python script that is being published to a GP service. One of the things it does is create a PDF file and save it. When run direct from ArcMap it saves correctly to the designated folder, but then when we publish the script to a GP service, it replaces the file path with a relative path.
We want the file path to remain absolute in this case - the target directory is permanent and accessed by other applications. In our tests we are just using a local directory, although in the production environment it is likely to be a mapped network drive.
We have tried a basic string such as r'd:\myfolder\myfile.pdf' and also os.path.join(r'd:\myfolder', 'myfile.pdf').
Our currently workaround is to edit the script file once published and replace the path again, but that seems rather hacky. It seems like there should be another, simpler way!