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.
workflow variables not updating in will_close() handler
-
I have a custom UI I'm presenting in a Python script action. My custom view class has a
will_close()
handler where I want to save off some values to two workflow variables I've set up in previous steps. Here's my handler:def will_close(self): clist = u'\n'.join(u'{} :: {}'.format(_, self.wordlist[_]) for _ in self.correct_words) wlist = u'\n'.join(u'{} :: {}'.format(_, self.wordlist[_]) for _ in self.wrong_words) workflow.set_variable('correct_words', clist) workflow.set_variable('wrong_words', wlist)
The values of
correct_words
andwrong_words
are output using Set File Contents actions to two files in Dropbox, creating them if they don't already exist. The files are being created as they should, but they are empty!If I add some
print
statements to mywill_close()
handler, I can see in the console thatclist
andwlist
contain exactly what they should contain.If I pause the workflow at the first Set File Contents action, I can see that the variable
correct_words
contains no value.Any suggestions?
-
OK, well, I was able to save off my data using
editor.set_file_contents()
to do it directly instead of setting the filename withworkflow.set_variable()
and then using a Set File Contents action but I'm still curious why the latter doesn't work.