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.


    will_close bug (e.g. stash and recent betas)

    Pythonista
    beta bug willclose
    4
    7
    6255
    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 last edited by JonB

      @omz, In the latest beta, when running stash, if one switches to the console and types anything, all stash output gets sent to the console instead of the stash window. also, I am getting a lot more crashes when swicthing getween stash and console, for instance, starting a pip install, then tabbing over to the console causes a crash (works fine in pythonista2)

      I realize stash is not your responsibility... but were there some fundamental changes with how the interpreter or console work in the last beta or two, that we need to ve working around? Any changes with how threads would work, for instance the thread state where sys.stdout is kept seems to be getting clobbered whenever typing in the console.

      1 Reply Last reply Reply Quote 2
      • JonB
        JonB last edited by

        specifically: stash installes a custom sys.stdout which mimics StdOutCatcher. This seems to get overridden as soon as the console is touched, as if pythonista is recreating the StdOutCatcher every console line?

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

          The monkey patch for sys.stdout is to allow running multiple commands of different output destinations without interfering each other. For an example, a HTTP server command can run at background with output redirected to a file, e.g. httpserver > logfile &. At the same time, a foreground client can talk to the server and send output to stash screen or Pythonista console. This is achieved by the custom stdout object checking the caller thread and acting accordingly.

          I admit the whole monkey patch is not ideal and hacky. So if @omz could provide an official mechanism to allow plugins for stdout etc, it would be fantastic.

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

            @omz, @ywangd Ok, I found the issue.
            Turns out will_close is now called on panel views whenever one switches from a view to the console.

            This appears to be a bug -- or cetainly not acting as documented, IMHO, will_close should be called when the view is closed, either from the close() method or user "x"ing the view. While it might be nice to have something like a will_show or will_hide to allow views to do someing when switching to or from a tab, will_close
            seems like it should be reserved for actual closing of the view.

            As a temporary workaround, we should probably disable will_close in stash for beta versions 30012 and 30013 ( i forget where this started)

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

              Thanks @JonB ! It was quite tricky to nail it down. I disabled the will_close call and it is now available in the dev branch. Hopefully this bug will be rectified soon. Thanks!

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

                I see, thanks! Should be fixed in the next beta.

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

                  @hyshai and @shaun-h Did the sys.stdout changes in the current betas also break the two youtube-dl implementations in Pythonista-Tools or is it just user error on my end?

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