Forum

Author Topic: Metashape.app.document is NoneType  (Read 1457 times)

linshuh

  • Newbie
  • *
  • Posts: 7
    • View Profile
Metashape.app.document is NoneType
« on: September 25, 2020, 11:08:57 PM »
Hi all,
I am using Metashape Pro 1.6.4 pure Python version. (Not IDE in the Metashape software GUI)
But I find it is confusing to initialize.

Code: [Select]
>>>app = Metashape.app
>>>doc1 = app.document
>>> type(doc1)
<class 'NoneType'>

>>> doc2 = Metashape.Document()
>>> type(doc2)
<class 'Metashape.Metashape.Document'>

>>>app.document = doc2
AttributeError: attribute 'document' of 'Metashape.Metashape.Application' objects is not writable

I wonder:
(1) Why "doc1" is NoneType? Since this initialization is in tutorial.
(2) Is there a way to edit the Metashape.app.document?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Metashape.app.document is NoneType
« Reply #1 on: September 28, 2020, 06:32:56 PM »
Hello Linshuh,

Metashape.app.document can be only used for the GUI-based scripts, as this call is related to the currently opened project.

For the command-line run scripts the correct way is creating a new Metashape.Document() instance.
Best regards,
Alexey Pasumansky,
Agisoft LLC