Forum

Author Topic: python stdout, stderr, photoScan console access  (Read 4694 times)

jdyuen

  • Newbie
  • *
  • Posts: 4
    • View Profile
python stdout, stderr, photoScan console access
« on: March 13, 2012, 12:41:58 AM »
Hello,

I have been playing around with python scripting and will definitely make use of it, but have run into a couple issues.

How can I write to the PhotoScan console from a python script loaded from Tools - Run Script...
For example, print("Hello World") works from the console but not from Run Script.

Also, when I "Run Script" and there are errors in the python, where is this written to? Nothing shows up for me in the PhotoScan console. Is there a way to direct stdout and stderr to the console?

Thanks!

jdyuen

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: python stdout, stderr, photoScan console access
« Reply #1 on: March 13, 2012, 01:01:01 AM »
To add on:

I can direct sterr and stdout to a file by doing the following at the beginning of the python script:
 sys.stdout = open("out.txt","w")
 sys.stderr = open("err.txt","w")

Still wondering how to direct to the PhotoScan console.

Thanks.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 9034
    • View Profile
Re: python stdout, stderr, photoScan console access
« Reply #2 on: March 13, 2012, 12:13:30 PM »
Hello jdyuen,

Are you sure that this script do not work if run "Run script" command is used:

Code: [Select]
import PhotoScan
print("Hello world")

Python errors are displayed in PhotoScan console starting version 0.8.5. You can try the latest pre-release version to check that - http://www.agisoft.ru/forum/index.php?topic=322.msg1291#msg1291
Best regards,
Alexey Pasumansky,
AgiSoft LLC

jdyuen

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: python stdout, stderr, photoScan console access
« Reply #3 on: March 13, 2012, 07:55:13 PM »
Hi Alexey,

Thanks for the quick reply. I am currently running version 0.8.4 which explains why it isn't working for me. I will try 0.8.5 (didn't know it was available!)