omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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)

    Pythonista
    version
    3
    5
    3130
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phuket2
      Phuket2 last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by ccc

        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.

        1 Reply Last reply Reply Quote 0
        • Phuket2
          Phuket2 last edited by

          @ccc, thanks. I did that but without the ImportError. Will change

          1 Reply Last reply Reply Quote 0
          • Olaf
            Olaf last edited by

            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>
            
            1 Reply Last reply Reply Quote 0
            • ccc
              ccc last edited by

              Awesome!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors