Pythonista crash during start launch_stash.py
Steps for reproduce
- Install via
import requests as r; exec(r.get('https://bit.ly/get-stash').content) - Launch
launch_stash.pyfrom
Result
In This phone folder appear _objc_exception.txt with text:
The app was terminated due to an Objective-C exception. Details below:
2023-05-08 08:28:08.740591
Modifications to the layout engine must not be performed from
a background thread after it has been accessed from the main thread.
Env:
- Pythonista v 3.4 (340012)
- Stash 0.7.5 (latest master, same on dev)
- Ios 15.6.1
Try this command instead... https://github.com/ywangd/stash/issues/462#issuecomment-1472858042
Tried, same result.
@mrkeuz @cclauss I ran into same problem...
However this issue could be workarounded following steps as below:
- Set breakpoint at the '_stash.launch(ns.command)' line at the bottom of the "launch_stash.py" file
- Run the launch script with Debug mode
- When it reaches the breakpoint, run with "single step" and the terminal window will show up
I have no idea how Debug mode made the difference...
有用 (it works)
@cclauss Why is this closed ? I have this problem and the suggested comment did not work. If I do the debug trick suggested by @lanceDee I see the console but then when I single step the terminal window does show up but in the next step the app crashes.
@cclauss Why is this closed ? I have this problem and the suggested comment did not work. If I do the debug trick suggested by @lanceDee I see the console but then when I single step the terminal window does show up but in the next step the app crashes.
Yes, it does crash when you step over and do nothing with the console. But as long as the console is active, you should be able to run some shell command with it, and if you found the window hang, just press the "single step run” for another time. However, official fix for this issue is still needed, please try the trick cautiously.
Additional notes.
-
Found workaround
Edit
launch_stash.pyreplace line 103_stash.launch(ns.command)with:# Line 103 replace with: import ui @ui.in_background def launch(*args): _stash.launch(*args) launch(ns.command) -
Similar crashes in scripts
I also found crash on other
Pythonistaexamples. I.e. altimeter example also crash (except without_objc_exception.txt)Somewhere in lines:
... main_q = NSOperationQueue.mainQueue() altimeter.startRelativeAltitudeUpdatesToQueue_withHandler_(main_q, handler_block) ...I found many discussions on
omzforum i.e. this or this I.m. not IOS developer, so cannot summarize reports about main/background threads using in obj-c, but maybeomztopics about Pythonista 3.4/3.4 beta helps for someone.
I just ran into this issue (Stash crashing as soon as you run launch_stash.py). I can confirm that the workaround solved the issue (thanks @mrkeuz). Seems like the source file should be updated?
Additional notes.
Found workaround
Did you create a pull request?
