Getting SG Desktop version from code

Is there a way to query what version of SG Desktop someone is running from Toolkit (with the assumption that the code running was launched from SG Desktop)?

The use case is I’d like to collect some metrics for error/bug reporting without having to require users to go to the About... menu in SG Desktop and send a screenshot.

I’m specifically looking for the “App Version” highlighted here:

Hi @kporangehat

That string is defined in the file bootstrap_version.py in the hierarchy of the installed desktop.
Unfortunately you will need to set your PYTHONPATH accordingly to be able to import the file.

e.g.

% PYTHONPATH=/Applications/Shotgun.app/Contents/Resources/Desktop/Python/helpers python3 -c 'from bootstrap_version import DESTKOP_APPLICATION_VERSION; print(DESTKOP_APPLICATION_VERSION)'
v1.7.3

Might be easier just to grep for it…

% grep DESTKOP_APPLICATION_VERSION /Applications/Shotgun.app/Contents/Resources/Desktop/Python/helpers/bootstrap_version.py
DESTKOP_APPLICATION_VERSION = "v1.7.3"

-Patrick

1 Like

Thanks Patrick, this is perfect!

2 Likes

Hey @patrick-hubert-adsk, it’s worth pointing out the global var name in that file has a typo in it that tripped me up for a bit this morning :slight_smile:

DESTKOP_APPLICATION_VERSION should be DESKTOP_APPLICATION_VERSION

for your next update…

cheers,
kp

Thanks for the heads-up @kporangehat !

I (obviously) did not even notice. The brains works in mysterious and funny (haha) ways.

-Patrick