Thank you Alexey. I have attempted to integrate the RunScript task into a test version of my code, shown here:
import Metashape, sys
root = "Z:/"
path = sys.argv[1]
doc = Metashape.Document()
doc.open(path) #loading existing project using relative path from the root
chunk = doc.chunk #active chunk of the project
client=Metashape.NetworkClient()
tasks = []
task = Metashape.Tasks.RunScript() #Reducing overlap as network task
task.code = 'import Metashape\ndoc = Metashape.Document()\ndoc.open("Z:/projects/pilot_testing/PythonTesting.psx", ignore_lock = True)\nchunk = doc.chunk\nchunk.reduceOverlap(overlap=4)\ndoc.save()\n'
tasks.append(task)
#converting tasks to network tasks
network_tasks = []
for task in tasks:
if task.target == Metashape.Tasks.DocumentTarget:
network_tasks.append(task.toNetworkTask(doc))
else:
network_tasks.append(task.toNetworkTask(chunk))
client.connect('my.server.here')
batch_id = client.createBatch(path[len(root):], network_tasks)
client.resumeBatch(batch_id)
print("Reducing overlap ... Check the network monitor now")
However, the document fails to open and I am presented with the error message :
2021-07-06 21:23:17 File "<string>", line 3, in <module>
2021-07-06 21:23:17 OSError: Can't open file: No such file or directory (2): Z:/projects/pilot_testing/PythonTesting.psx
2021-07-06 21:23:17 Error: Can't open file: No such file or directory (2): Z:/projects/pilot_testing/PythonTesting.psx
I know that the path to the file in the RunScript command is correct, since I copied it directly from the Metashape GUI.
I am aware that during your mentioned example, the user was directed to a slightly different code structure in the RunScript task ,involving using the command
doc.open(Metashape.app.settings.network_path + "' + project_path + '", ignore_lock = True)
to open the document. However, when I alter my code structure to be reflective of this, I am presented with a similar error message, and the document also fails to open.
I am unsure why and any help would be appreciated, as this would significantly reduce the time a user needs to spend at a desk for processing. I see in your previous post, you mention that the code is intended to work with version 1.7.4 pre-release. I am using 1.7.2 . 12070, so I am certain that there are just some issues to do with specifying the file paths correctly. Within the current structure, it is no issue for me to send the "normal" network processing type jobs off (analyze photos, align photos etc.). I just cannot make the runscript process open the file correctly, whether I specify the file location directly, or define the path earlier on in the script.