Run out how to use python in Pythonista's interpreter.
I made a little script that will run a python module or script with args. It simulates the console command:
>python -m module|script [args]
It sets the directory to the currently opened editor file. It's useful for running standard library modules and .py files with args.
@briarfox Thanks, that looks neat. I didn't know runpy, I must learn it. I'd been using execfile() and/or silent notifications.
@tony I just stumbled upon it. runpy contains two functions and it's easy to use :) Its nice to be able to finally run modules via command line. Would have saved me a lot of banging my head against a wall earlier on. Makes TDD much easier.
@briarfox. It's a great utility, I like it. I was hoping even that runpy might avoid the threading issues, but it seems not. This little test script has the same problems as if execfile or silent notifications were used. Its the current version of Pythonista though I think, not you.
import console # test which thread are we in... console alert not good in main ui thread console.alert('Test', button1 = 'OK', hide_cancel_button = True)