How to view the value of a Metashape Application attribute that displays in angle brackets < >

Question:

How do I access the value of an object attribute that displays in angle brackets like: <attribute 'version' of 'Metashape.Metashape.Application' objects>?

Specifically, I am using the Metashape Python module and run the following lines within an interactive Python session:

import Metashape
a = Metashape.Application
a.version

and this is when I get

<attribute 'version' of 'Metashape.Metashape.Application' objects>

I’ve tried print(a.version) and get the same output.

According to the module reference doc, this attribute should be a string, so I’m confused why it can’t just be displayed as a string.

Asked By: dyoung

||

Answers:

According to the docs:

An instance of Application object can be accessed using Metashape.app
attribute, so there is usually no need to create additional instances
in the user code.

so…

import Metashape
print(Metashape.app.version)

If you want to do it your way, you need to instance Application.

import Metashape
app = Metashape.Application()
print(app.version)
Answered By: OneMadGypsy

That Docs said:

…An instance of Application object can be accessed using Metashape.app attribute…

So you can print the value of version use Metashape.app

import Metashape

a = Metashape.app
print(a.version)
Answered By: Jordy

In addition to Metashape.app.version, which returns x.x.x version number as a string, you can use Metashape.version of Metashape.Version() type, this approach allows to get .major, .minor, .micro and .build numbers:

[in] Metashape.version

[out] 2.0.1

[in] Metashape.version.major, Metashape.version.minor, Metashape.version.micro, Metashape.version.build

[out] (2, 0, 1, 15925)

Answered By: dead_PyKto
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.