Forum

Author Topic: photoscan.sh return code  (Read 1239 times)

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
photoscan.sh return code
« on: May 07, 2018, 08:46:58 PM »
While doing python scripting on Ubuntu 16.04 with photoscan 1.4.1, I've noticed photoscan.sh always returns 0 even when my script raises an exception. My solution is to explicitly call sys.exit(1) within my script, which causes photoscan.sh to return 1. But I'm not sure if it's safe to call sys.exit directly--does this prevent PhotoScan from cleaning up?

To be precise, here are two example scripts:

test_a.py:
Code: [Select]
raise RuntimeError("error!")
test_b.py:
Code: [Select]
import sys
sys.exit(1)

...and when I run them:
Code: [Select]
python test_a.py # returns 1
photoscan.sh -platform offscreen -r test_a.py # returns 0

python test_b.py # returns 1
photoscan.sh -platform offscreen -r test_b.py # returns 1

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14110
    • View Profile
Re: photoscan.sh return code
« Reply #1 on: May 13, 2018, 02:44:43 PM »
Hello william,

We will fix exit code issue in the version 1.4.3.

The workaround that you are using could result in remaining temporary files in the project folder (for PSX format).
Best regards,
Alexey Pasumansky,
Agisoft LLC