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.


    UI use in action menu script results in eventual lockup

    Pythonista
    2
    4
    2851
    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.
    • Gcarver166
      Gcarver166 last edited by

      I created a script I added to my action menu that uses a TableView to show me a list of templates such as for loop, if statement, function definition etc. It runs ok and I can activate it continuously with no issues. However if I run it more than once and then use any of my other action scripts pythonista will lock up. If I run it only once the other scripts continue to work ok. I've stripped the script down and created a gist for it.

      https://gist.github.com/GuyCarver/d5da6f4b29a844a5865a

      I've attempted to determine exactly what may be causing the lockup with no success. I'm hoping there is a solution as being able to have actions use UI is very nice.

      Thanks

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

        Thank you, I'm looking into this.

        Q: Does the deadlock happen for all scripts that you run afterwards, e.g. does a simple print 'hello world' script also trigger it?

        I think I've identified a bug that has to do with how raw_input, console.input_alert etc. are handled, and I can definitely reproduce the bug when the script that is run afterwards contains any of this, but for a simple print 'hello world' script, the deadlock doesn't happen for me.

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

          The lockup happens for me in any script that uses editor functions or console.input_alert. Most of my scripts modify the current file in some way and they all lock up. A hello world script works ok for me as well.

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

            Thanks, that confirms my theory, I think I'll be able to fix this in the next update.

            As a workaround right now, you could try to add the following at the bottom of your script:

            del v.tv
            del v
            import gc
            gc.collect()
            

            I'm not completely sure if this will fix the deadlock in all cases, but it seems to help.

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