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.
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)
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)
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)
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.
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)
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)
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)