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.load_view() fails with 'UI could not be loaded' (Custom Action Advanced)
-
Hi all,
just started on my Jekyll's post settings editor and I'm kinda lost now, because it fails to load my view and don't know what else to try. Here's the link to the unlisted (for now) workflow.
What's hapenning ...
1st scenario
- start Editorial from scratch
- try to run this workflow
- fails with UI could not be loaded
2nd scenario
- start Editorial from scratch
- just for fun, run Calculator workflow (included within Editorial)
- try to run my workflow
- Calculator UI appears with ton of messages about not working bindings, ...
Anyone have an idea what's going on?
iPad Air 2 & Editorial 1.1.1
-
If I move my stuff under
Run Python Script
(without input parameters), it does work. It just doesn't work if it's withinCustom Action (Advanced)
. -
Here's rewritten version which does work perfectly (not
Custom Action
, justRun Python Script
). Anyway I'm still curious what's wrong with the first version (OLD ...). -
I can not resolve your issue but I like your code... In
parse_file_settings()
you write:string.find(content,SEPARATOR) # which can be rewritten content.find(SEPARATOR)
This is because content is already a str so it has a
.find()
method. This way is shorter, easier to read, and means that you no longer need toimport string
.However, I sense that
parse_file_settings()
could be made even simpler thru the use of:before, _, after = content.partition(SEPARATOR)
str.partition()
really simplifies finding text between separators.In
update_post_settings()
you write:output = '---\n' for name, value in settings.iteritems(): output += '%s: %s\n' % (name, value) output += '---\n' # which could be rewritten out_list = ['%s: %s' % (name, value) for name, value in settings.iteritems()] output = '---\n%s\n---\n' % '\n'.join(out_list)
The first line is a list comprehension which is really fast and it avoids doing string concatenation which is slow in Python. The second line joins the strings instead of concatenating them which is much faster. These improvements will help as settings get longer but will be of negligible value on short files.
-
Thanks @ccc for your comments. I updated the workflow. Skilled asm, C, C++, Swift, Obj-C, ... guy, but total newbie in Python :-)
-
But back to my original issue. I just tried to:
- delete OLD - RV: Jekyll Edit Post Settings
- install it again
- run Calculator for fun
- run OLD - RV: Jekyll Edit Post Settings
Still same problem - Calculator UI appears in my sheet, because UI can't be loaded. Here's the video of how it behaves.