Author Topic: RunScript to execute external script version 1.5.1  (Read 1383 times)


  • Newbie
  • *
  • Posts: 13
    • View Profile
RunScript to execute external script version 1.5.1
« 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.


  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: RunScript to execute external script version 1.5.1
« Reply #1 on: March 02, 2023, 11:28:27 AM »
I am absolutely sure that the issue has been resolved - Still have the solution to your problem as I ran into the same error - Maybe it will help others in the future.

You have the 'network_tasks' wrapped in a nested list (possibly a copy-paste error like mine).

You should change that line
Code: [Select]
batch_id = client.createBatch(path[len(root):], [network_tasks] )
Code: [Select]
batch_id = client.createBatch(path[len(root):], network_tasks)