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.


    Python 3.x Progress Update

    Pythonista
    56
    395
    526504
    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.
    • marcus67
      marcus67 @omz last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        Random observations so far:

        • Startup time (the delay between the editor appearing and pythonista_startup being run) is much shorter on Pythonista 3 than on Pythonista 2. Not sure if that might be because my Pythonista 2 contains a ton of files and my Pythonista 3 is almost empty.
        • exit, sys.exit and SystemExit exceptions actually kill Pythonista, which only os._exit used to do.
        • async and await are not treated as keywords by Pythonista. It is true that they can still be used as normal identifiers (until Python 3.7) for backwards compatibility, but that doesn't mean that you should do that.
        • The behavior of editor.open_file was changed - previously it took a path relative to ~/Documents, now it expects an absolute path. (This probably changed in an earlier beta, but I only noticed it now.)
        • The "welcome" file seems to be missing in Pythonista 3.
        1 Reply Last reply Reply Quote 1
        • ccc
          ccc last edited by

          You can crash P3 if you try to create a new file in the editor while you are in the P2 folder.

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

            @omz What's going to happen with the template? Bake everything into one with some sort of switch/delete operation? Is it already secretly baked in? Will there be a separate one?

            Webmaster4o 1 Reply Last reply Reply Quote 1
            • Webmaster4o
              Webmaster4o @Tizzy last edited by

              @Tizzy There will probably be a second one.

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

                Hey, @omz, In some recent beta (maybe not this one) you changed the console text input to be something other than PA2PromptTextField. How can I find this view now, in objc_util? It doesn't have a distinct class name anymore.

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

                  @dgelessus

                  Startup time (the delay between the editor appearing and pythonista_startup being run) is much shorter on Pythonista 3 than on Pythonista 2. Not sure if that might be because my Pythonista 2 contains a ton of files and my Pythonista 3 is almost empty.

                  I've optimised the importcompletion module a bit in Pythonista 3 by using a cache for modules that can't change (pylib). It has to load all available modules on startup for the console's autocompletion to work. For some reason (that I don't really understand), this was much slower using Python 3, so the optimisation was really necessary, but Pythonista 2 could probably also benefit from it. The fact that you don't have as much stuff in site-packages probably also helps quite a bit though.

                  exit, sys.exit and SystemExit exceptions actually kill Pythonista, which only os._exit used to do.

                  Thanks, I'll have to look into that.

                  async and await are not treated as keywords by Pythonista.

                  I have that on my todo list.

                  The behavior of editor.open_file was changed - previously it took a path relative to ~/Documents, now it expects an absolute path. (This probably changed in an earlier beta, but I only noticed it now.)

                  I actually re-implemented the entire module for Pythonista 3 using objc_util, and apparently forgot that open_file should be able to deal with relative paths...

                  The "welcome" file seems to be missing in Pythonista 3.

                  I'll write that when the app is finished.

                  @ccc

                  You can crash P3 if you try to create a new file in the editor while you are in the P2 folder.

                  Oops! Good to know.

                  @Tizzy

                  What's going to happen with the template?

                  I'll make a separate template when the app is done, but I don't really want to maintain that alongside the beta.

                  @Webmaster4o

                  Hey, @omz, In some recent beta (maybe not this one) you changed the console text input to be something other than PA2PromptTextField.

                  No, I haven't changed that, it should still be a PA2PromptTextField.

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

                    @omz importcompletion is not relevant for the template? if so is it removed?

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

                      @Tizzy No, it's not relevant there, and I've essentially removed it to speed up launching standalone apps.

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

                        UPDATE: figured out there is a built in tool in sublime text to convert spaces to tabs in indentation.
                        View > Indentation > Convert Indentation to Spaces

                        PS - anyway to scale the size of images posted here?

                        Also, the traceback popover doesn't seem to let me jump to the actual spot of the error as it seems to usually do in Pytonista 2, but it does show the file and line number. The last spot it lets me jump to is the import statement of the module where the error is actually at, not the module itself...

                        Also noticed there is a "convert tabs" action built into Pythonista 3 not yet implemented....I'm guessing this will do the same thing.


                        Ok, so I just tried running my app in Pythonista 3 beta. The tool to 2to3 seems to work.

                        But I've bumped into something right away. Seems to be much less forgiving in terms of tabs/spaces? Can anyone recommend a tool for sublime text to fix this kind of stuff? I've looked at it and it looks alright. I might have copy pasted it from another part of the code...?

                         "TabError: inconsistent use of tabs and spaces in indentation"
                        
                        

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

                          @Tizzy Check out tabnanny which is a Python standard library module. You gotta love the name!!

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

                            I am using Pythonista since december 2015.

                            I am wondering a little bit about one behaviour of the editor. I just checked on iPhone4 with iOS7 and Pythonista 1.5 compared to Pythonista 2.0x and Pythonista 300001.

                            If I am on the beginning on a line with indent in v1.5 and press return it preserve the indent. But in all newer versions I am in column 1. I like the behaviour of version 1.5 in this case.
                            I am sure there is a good explanation why this have changed (and I am sure this was not accidentally).

                            cursor at position ^:
                            ____ line1
                            ____ ^ line2
                            ____line3

                            after pressing return in version > 1.5
                            ____line1

                            line2
                            ____ line3

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

                              I found an issue in ui editor. I have assigned an image to an button in the version 201002 or earlier. This button is no longer assigned in version 3000001. If I assign another image in version 2010004 (only) this image on the button is also available in version 300001.

                              And it would be great , if after assigning an image that the image is still selected in the image selection.

                              wnMark 1 Reply Last reply Reply Quote 0
                              • omz
                                omz last edited by

                                @wnMark said:

                                I am sure there is a good explanation why this have changed (and I am sure this was not accidentally).

                                Well, to be honest, this is just something I haven't gotten round to yet. It's been on my todo list for a while. The reason it changed in 2.0 is basically that I re-wrote large parts of the editor to make it more modular and reusable, mostly so that I can share a larger code base with Editorial, but also to enable features like syntax highlighting for different languages. This has worked pretty well, but there are still a few little things that worked better in the old version.

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

                                  @wnMark said:

                                  I found an issue in ui editor. I have assigned an image to an button in the version 201002 or earlier. This button is no longer assigned in version 3000001. If I assign another image in version 2010004 (only) this image on the button is also available in version 300001.

                                  The image picker in 2.0 (and betas before 2010004) was extremely buggy, and it's difficult to maintain backwards-compatibility with that because it essentially saves incorrect image names to the pyui file. This should be fixed in 201004 (and 3.0), but it may unfortunately be necessary to fix old pyui files manually by re-selecting the images.

                                  wnMark 1 Reply Last reply Reply Quote 0
                                  • wnMark
                                    wnMark @omz last edited by

                                    @omz said:

                                    The image picker in 2.0 (and betas before 2010004) was extremely buggy, and it's difficult to maintain backwards-compatibility with that because it essentially saves incorrect image names to the pyui file. This should be fixed in 201004 (and 3.0), but it may unfortunately be necessary to fix old pyui files manually by re-selecting the images.

                                    @omz
                                    I understand, not a big problem for me

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

                                      Just tried the appex module. Using appex.get_url() from the extensions console I got the error:

                                      Traceback (most recent call last):
                                      File "<string>", line 1, in <module>
                                      File "/var/mobile/Containers/Bundle/Application/3DC76E83-91BE-4A1F-A8A2-2A00120079CC/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/appex.py", line 114, in get_url
                                      return _path2url(url)
                                      File "/var/mobile/Containers/Bundle/Application/3DC76E83-91BE-4A1F-A8A2-2A00120079CC/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/appex.py", line 5, in _path2url
                                      import urlparse
                                      ImportError: No module named 'urlparse'

                                      Webmaster4o 1 Reply Last reply Reply Quote 2
                                      • Webmaster4o
                                        Webmaster4o @tomkirn last edited by

                                        @tomkirn I believe that's a difference in Python 3, yeah. I believe it should be from urllib3 import urlparse. @omz will need to fix this.

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

                                          Isn't it called urllib.parse in Python 3?

                                          @omz Bug with ui.TableView.delete_rows: when deleting rows from a table with sections, the tuples indicating the rows to delete have to be reversed, i. e. currently you have to write tableview.delete_rows([(row, section)]), and what I would expect to be correct is tableview.delete_rows([(section, row)]) (as described in the docs for ui.TableView.insert_rows).

                                          1 Reply Last reply Reply Quote 0
                                          • wnMark
                                            wnMark @wnMark last edited by wnMark

                                            I am missing the keyboard shortcuts (callable with COMMAND key) in 300001. They are available in 201004

                                            Ole @Omz if you fix this, more shortcuts would be great. Like Page Up/Down (At the moment CONTROL-Up/Down and COMMAND-Up/Down do the same and go to start or end of file).
                                            OPTION DOWN is going two lines downwards and only one line upwards. More lines would be great (or goto end/start of a logical "block")

                                            Or instead of Page Up/Down, goto prev/next "def()"

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