Forum

Author Topic: Console output and stdout  (Read 1895 times)

marg

  • Newbie
  • *
  • Posts: 18
    • View Profile
Console output and stdout
« on: May 27, 2021, 09:53:14 AM »
Hi!
I am including metashape api (version 1.5) into a larger processing chain, and my goal is to tame the console output a bit, and only log essential values from the alignment/densecloud/orthomosaicing process. Unfortunately this does not work easily, since there is no variable to control the verbosity of the chunk..*() functions. Redirecting stdout (via contextlib or directly) does also not work for some inexplicable reason. Any idea how to deal with this?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14816
    • View Profile
Re: Console output and stdout
« Reply #1 on: June 12, 2021, 04:16:28 PM »
Hello marg,

I think that the easiest way would be redirecting the script output from the OS command-line directly (providing that the script is started in headless mode):
Code: [Select]
metashape.exe -r script.py > output.txt 2>&1
Best regards,
Alexey Pasumansky,
Agisoft LLC

marg

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Console output and stdout
« Reply #2 on: June 14, 2021, 12:07:47 PM »
Thanks for the reply.
Yes, this is the way I am currently doing it, redirect everything to some file. But this gives me no flexibility. Since the metashape workflow is just part of a bigger processing chain (of which I also want a couple of lines of comprehensive output), I cannot selectively decide which part of the metashape output I want, and which I don't. The workaround I have now is redirect everything to some temporary file, and log the parts I want from metashape (x/x cameras aligned, ortho written etc) manually. I was just hoping there would be a more elegant way to deal with the metashape console output.