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.


    How to ask a good question

    Pythonista
    8
    29
    18742
    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.
    • JonB
      JonB @Matteo last edited by JonB

      @Matteo An approach to enable fstrings in 3.1:

      In stash:
      pip install tokenize_rt

      Then, Download future_fstrings.py, and install into site-packages-3.

      Create usercustomize.py in site-packages-3, which includes

      import future_fstrings
      future_fstrings.register()
      

      (Iirc, pythonista_startup doesnt get executed by the extension, but usercustomize.py does)

      Finally, add

      # -*- coding: future_fstrings -*-
      

      to the top of any file where you want fstrings enabled, such as zrzka's script.

      Matteo 2 Replies Last reply Reply Quote 1
      • Matteo
        Matteo @JonB last edited by Matteo

        Hi @JonB, thank you for suggestion! I will try your procedure.

        @enceladus thank you for showing me an other way to do what I ask: when I will be able to use @zrzka script with python 2.7.12 by trying to copy the code here (as you suggest) in clipboard, I will try also the @omz script!

        Regards

        1 Reply Last reply Reply Quote 0
        • Matteo
          Matteo @JonB last edited by

          Hi @JonB , your procedure works very well! @zrzka script works very well in Pythonista version I use, Thank you guys!
          Regards

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

            Guys, below in the snippet is a func 'pythonista_info'. I am pretty sure @JonB wrote this function a long time ago. It still seems to work ok. My wapper to copy it to the clipboard is not so nice(user friendly). But a refined version of what is below could be used as a wrench item to get details about the env when you are posting to the forum. I didn't attempt to make a nice version of it. I think others would do a better job than me.

            This is quite old, so maybe it does need updating...

            import clipboard, console
            import os, platform, plistlib, scene, sys
            
            
            def pythonista_info():
                plist = plistlib.readPlist(os.path.abspath(os.path.join
                                          (sys.executable, '..', 'Info.plist')))
            
                ios_ver, _, machine_model = platform.mac_ver()
            
                return dict(pythonista_ver_str=plist['CFBundleShortVersionString'],
                            pythonista_ver_num=plist['CFBundleVersion'],
                            ios_ver_str=ios_ver,
                            screen_resoultion=scene.get_screen_size(),
                            screen_scale=scene.get_screen_scale(),
                            machine_architecture=platform.architecture()[0],
                            machine_model=machine_model,
                            )
            
            if __name__ == '__main__':
                info = pythonista_info()
                str_info = "\n".join(str((k, v)) for k, v in info.items())
                clipboard.set(str_info)
                print(str_info)
                console.hud_alert('Pythonista Env copied to clipboard')
            
            cvp 1 Reply Last reply Reply Quote 1
            • cvp
              cvp @Phuket2 last edited by cvp

              @Phuket2 Immediately integrated in my apps/tools

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

                Regarding the pythonista_info function I posted above. I have since had a few freezes with using it (Pythonista becomes unresponsive) and a hard restart is required.
                Ok, I found the original post, its over 2 years old. @ccc , @JonB and @dgelessus all helped out on this post. It would be nice if anyone could see why it would be intermittently freezing now. I can imagine quite a few things have changed in 2 years :). Anyway, it would nice to have it stable or an equivalent for easily getting your devices info, to be able to paste into posts if needed. I realise the dict keys could be better if they are to be used as part of the output.
                @cpv, have you had a freeze using it?

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

                  @Phuket2 No freeze but not used a lot...

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

                    @cvp , ok thanks. There is something wrong though, if I use it multiple times I can get it to freeze. Hopefully someone will spot the problem

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

                      @Phuket2 I've corrected a serious error 😂

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