-
ClareMacrae
Thank you for reporting this...
I've noticed that my various Sidebar workflows have not been working for a while in the beta, and this would explain why.
-
ClareMacrae
I said:
At some point recently, Editorial's Python has gone from saying
sys.platform
isunknown
to now sayingiphoneos
.In beta 130010, it now says
sys.platform
isios
. Which means I have to re-copy my site-packages over...On the up-side, it was really useful that the traceback was shown in the console - thanks very much indeed for this - it made the problem immediately clear... :)
(If this changes again, please could you put it in the TestFlight release notes, as it's a lot easier to update the site-packages in advance of the change in value....)
-
ClareMacrae
Yes, a thousand times yes!
I'd love to see this, or any other way of quickly navigating to favourite locations... :)
-
ClareMacrae
Thanks... In scripts, I'm only ever reading from files in the Dropbox directory, not writing to them... (The only time I ever write to them, I open them in the Editorial editor and change the contents there...)
Would you consider mentioning prominently in the notes for the next version of Editorial that the result of
sys.platform
has changed, please, to help others out?Getting this sorted out is a huge relief for me, given my dependence on Editorial - thanks for the
import traceback; traceback.print_last()
tip! -
ClareMacrae
Thank you. That allowed me to understand the problem.
I was calling a helper function I'd written, and put in
site-packages
this starts with this:def dropbox_directory(): if sys.platform == 'win32': return os.getenv('MY_DROPBOX_DIR') elif sys.platform == 'unknown': ....
At some point recently, Editorial's Python has gone from saying
sys.platform
isunknown
to now sayingiphoneos
.I hadn't coded for
else raise an exception
so various such helper functions now returnNone
.... and depending on where the function is called from, I get different kinds of error messages about things that don't work withNone
...My only problem now is how to get the fixed scripts over to Editorial, as the Workflow I use to import
site-packages
is itself broken... I guess I'll have to initially edit the relevant Workflow to put in hard-code values instead of calling helpers.Is there a recommended way to access the Dropbox directory inside Editorial?
The code I had isn't very pretty, having evolved over a few different versions of Editorial:
def dropbox_directory(): if sys.platform == 'win32': return os.getenv('MY_DROPBOX_DIR') elif sys.platform == 'unknown': # Find the absolute path of the Dropbox folder, relative to the Workflows folder: # TODO Try using os.chdir(expanduser('~/Documents/')) instead # TODO The /private probably doesn't matter, now that I'm only showing the filename import editor commands_dir = editor.get_workflows_path() dropbox_dir = os.path.realpath(commands_dir + '/../Dropbox/') private_suffix = '/private' if dropbox_dir.startswith(private_suffix): dropbox_dir = string.replace(dropbox_dir, private_suffix, '', 1) return dropbox_dir
-
ClareMacrae
@omz Are there any particular requirements for the files in
site-packages
as to line-endings, character encodings or similar, please?The path is fine - the import commands work - the problem seems to be with what is imported.
-
ClareMacrae
Hi Ole,
I've only just seen your question...
I get this (with some added line wrapping):
>>> import sys >>> sys.path ['/var/mobile/Containers/Data/Application/3132ED2D-F6DF-4976-8984-2AFE7BE75247/Library/Application Support/Commands', '/var/mobile/Containers/Data/Application/3132ED2D-F6DF-4976-8984-2AFE7BE75247/Documents/site-packages-2', '/var/mobile/Containers/Data/Application/3132ED2D-F6DF-4976-8984-2AFE7BE75247/Documents/site-packages', '/var/containers/Bundle/Application/A35D4C58-A130-4CC8-94EB-3DDAAAE4F464/Editorial.app/Frameworks/PythonistaKit.framework/pylib', '/var/containers/Bundle/Application/A35D4C58-A130-4CC8-94EB-3DDAAAE4F464/Editorial.app/Frameworks/PythonistaKit.framework/pylib/site-packages', '/var/containers/Bundle/Application/A35D4C58-A130-4CC8-94EB-3DDAAAE4F464/Editorial.app/Frameworks/PythonistaKit.framework/pylib/site-packages/PIL_compat']
-
ClareMacrae
Just to note that the problem is still present in
1.3 (130006)
and1.3 (130007)
-
-
ClareMacrae
When I upgraded to the current Editorial beta, I found that any of my scripts that imported other scripts from site-packages were failing. Ole gave my the following lines to add to all my Python code in Workflows...
import os, sys sys.path.insert(0, os.path.expanduser('~/Documents/site-packages'))
I thought that this had worked, but whenever I invoke any workflow that calls other ones, I get this error:
"Workflow Error An error occurred in the action "Run Python Script": Line 10: Attribute Error: 'NoneType' object has no attribute 'endswith'"
Here is an example Python worflow script:
import os, sys sys.path.insert(0, os.path.expanduser('~/Documents/site-packages')) import console import editorial_workflows console.clear() editorial_workflows.document_and_check_workflows()
None of the code I'm calling contains 'endswith', so I'm guessing that the error is coming from code inside Editorial?
I'd be really grateful for any workaround, as I'm about to make really heavy use of Editorial for a week, and will really miss my workflows.
(My last resort is to go back to Editorial from the AppStore - but I'd miss split-screen)