KeyError: 'VariableName'
crock opened this issue · comments
Running in Pythonista 3 on iPad. Installed all the dependencies using the Stash add-on for Pythonista.
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts.py", line 5, in <module>
main()
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/cli.py", line 56, in main
convert_shortcut(args.file, args.output)
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/cli.py", line 18, in convert_shortcut
sc = shortcuts.Shortcut.loads(sc_data, file_format=shortcuts.FMT_SHORTCUT)
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/shortcut.py", line 53, in loads
return cls._get_loader_class(file_format).loads(string)
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/loader.py", line 69, in loads
shortcut.actions.append(cls._action_from_dict(action))
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/loader.py", line 85, in _action_from_dict
for p, v in action_dict['WFWorkflowActionParameters'].items()
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/loader.py", line 86, in <dictcomp>
if p in shortcut_name_to_field_name
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/loader.py", line 115, in deserialized_data
return deserializer(self._data).deserialized_data
File "/private/var/mobile/Containers/Shared/AppGroup/F82F97C6-B15F-41D4-B735-B51241CB9688/File Provider Storage/Repositories/python-shortcuts/shortcuts/loader.py", line 134, in deserialized_data
return self._data['Value']['VariableName']
KeyError: 'VariableName'
Thanks for the report :)
It seems like the library doesn't support this type of variable. Probably your shortcut contains some specific variable like "Shortcut input" or "clipboard" etc.
If you could share the extension (if it doesn't include any sensitive information), it would be helpful.
Also, I just released a new version (0.9.1), it should print in the exception which type it can't parse, it will help too:
shortcuts.exceptions.UnknownWFTextTokenAttachment: Unknown token attachment type: ExtensionInput
I'm closing this issue, for now, please, reopen it if you will have the same KeyError: 'VariableName'
with 0.9.1
.
And about unsupported features of shortcuts: create a new issue, please, if you need this library to support some action or variable.
Thanks :)