Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: eastonmbio on April 12, 2021, 12:47:57 PM

Title: RunScript to execute external script version 1.5.1
Post by: eastonmbio on April 12, 2021, 12:47:57 PM
I'm looking to execute an external script as a network task using the following tester code:

Code: [Select]
import Metashape

path ="Specify path to the PSX document:")
root ="Specify network root path:")

doc = Metashape.Document()
chunk = doc.chunk


network_tasks = list()

task = Metashape.Tasks.RunScript()
task.path = "C:/path/to/"

n_task = Metashape.NetworkTask() =
n_task.params = task.encode()
n_task.frames.append((chunk.key, 0))

batch_id = client.createBatch(path[len(root):], [network_tasks] )
print("Job Started...")

The code referred to in the path just imports Metashape. However, when running the script, I get the error message " TypeError: Task object expected". Clearly what I am passing in to the server is not recognised as a task. I am using version 1.5.1. I'm not sure if my code structure needs to change to accommodate network processing of the external script.