Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Determining The Pythonista Version (in code)
-
Is there away to determine the version of Pythonista in code. I have a feeling there is not. I did what I remember seeing @omz do once. Try to import a 1.6 only Pytonista module then do something from there on except.
I used dialogs, as I thought it would be a light one to dummy import even though I am not using dialogs. (Is there a better one to use, if we do it this way?)I did attempt to search the forum, but as you can imagine, this one of the worst search terms to be looking for here.
-
try: import dialogs except ImportError: exit('This script requires the dialogs module in Pythonista v1.6 or later.')
I do not know of any API call that allows you to determine the version of Pythonista at runtime.
-
@ccc, thanks. I did that but without the ImportError. Will change
-
Just trying (as above) definitely is the easiest and most pythonic way.
Alternatively, one could parse (with beautiful soup) the documentation file ~/Pythonista.app/Documentation/ios/new.html. For the App Store version, it contains<h2>Version 1.5<a class="headerlink" href="#version-1-5" title="Permalink to this headline">¶</a></h2>
-
Awesome!