Forum

Author Topic: Writing console log to text file  (Read 2755 times)

ascornelio

  • Newbie
  • *
  • Posts: 6
    • View Profile
Writing console log to text file
« on: March 05, 2018, 03:44:46 AM »
Hi there,

I'm trying to write the PhotoScan console log text to a local text file.
I'm finding rather strange results.

For example, I can easily do this using the python console in the GUI.
I do this by:
Code: [Select]
console_obj = PhotoScan.app.ConsolePane()
contents = console_obj.contents

# save contents  variable to text file etc...


This works when typing in the python console - the variable contents is a string with the console text.

However, when I try this from running PhotoScan via the command line and calling my python script, the contents variable is always empty...

Anyone else found this? Any advice?

I'm using version 1.4.1

Cheers,
Alex
« Last Edit: March 07, 2018, 07:09:41 AM by ascornelio »

ts

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Writing console log to text file
« Reply #1 on: March 06, 2018, 07:47:41 PM »
Hi Alex,

can't you just pipe the console output to a file using the terminal?

Like so:
./photoscan.sh -r script.py -platform offscreen > file.log (on Linux)

Drawback is you don't see whats going on while the script is running. If you want to follow what is being written to the file open another terminal and execute:

tail -f file.log

T

ascornelio

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Writing console log to text file
« Reply #2 on: March 09, 2018, 03:09:45 AM »
Thanks for the reply.

Thats a good idea and would work if I was running one photoscan project through the one cmd prompt. However I usually spam heaps of projects at once through the one cmd prompt so the txt output is very jumbled (since there can be n number of photoscan projects writing text to the one cmd prompt simultaneously).

I'll keep exploring options.

Cheers,
Alex