Forum

Author Topic: Assure document has been opened properly  (Read 1643 times)

Dud3r

  • Newbie
  • *
  • Posts: 9
    • View Profile
Assure document has been opened properly
« on: November 24, 2017, 06:33:12 PM »
Hi,
I'm trying to verify, that my already created Photoscan project has been opened properly:

Code: [Select]
import PhotoScan as ps

pf_proj = '/path/to/my/existing/document.psz'
doc = ps.Document()
    if not doc.open(pf_proj):
        print("ERROR: Could not open document: " + pf_proj)

I always get "ERROR: Cold not open document:", although the document seems opened properly.
Is there another way to check if the document is loaded correctly?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Assure document has been opened properly
« Reply #1 on: November 24, 2017, 07:01:06 PM »
Hello Dud3r,

In PhotoScan 1.3 doc.open() function is not returning anything, like status of the operation success, so I can suggest to use try-except approach:

Code: [Select]
try:
    doc.open(path)
except:
    print("ERROR")
Best regards,
Alexey Pasumansky,
Agisoft LLC

Dud3r

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Assure document has been opened properly
« Reply #2 on: November 24, 2017, 07:57:18 PM »
Thank you Alexey. That is basic Python. Should have thought of this.