Forum Archive

UI use in action menu script results in eventual lockup

Gcarver166

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

omz

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.

Gcarver166

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.

omz

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.