Forum

Author Topic: Passing Arguments through Metashape Console to python scripts  (Read 3488 times)

Roy

  • Newbie
  • *
  • Posts: 22
    • View Profile
Passing Arguments through Metashape Console to python scripts
« on: February 18, 2024, 10:15:18 AM »
Hello.

i'm trying to run a script from inside Metashape with the "Run Script" option.
I noticed that there is an "Arguments" row that I can put stuff in it.

How can I access to these arguments from the script itself?

Would Appreciate help.

Roy

Paulo

  • Hero Member
  • *****
  • Posts: 1495
    • View Profile
Re: Passing Arguments through Metashape Console to python scripts
« Reply #1 on: February 18, 2024, 02:07:15 PM »
Hi Roy,

in your script you would do the following:
Code: [Select]
import sys
argument1 = sys.argv[1]
argument2 = sys.argv[2]
...
argumentn = sys.argv[n]

Hope this helps
« Last Edit: February 18, 2024, 02:44:40 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor