Wrote more flexible version of your script: Open in Pythonista
My extension allows save into Pythonista from different sources:
- from app extensions:
- single files or entry directories, passed by file path
- single files or web-pages, passed by URL
- text data, passed as raw text (e.g. from Notes app)
- from Pythonista's Editor:
- text data of opened tab
To use this extension you also need to download and install (copy into the same folder) libs package (to be precise: misc and log modules) from the same Gitlab project.
I'll be glad to feedbacks =)