johandebeurs / alfred-mstodo-workflow

Fast task entry, searching and completion for Microsoft Todo via Alfred 4/5
MIT License
138 stars 4 forks source link

Error after updating to 0.2.0 #50

Closed mdonato-fn closed 1 year ago

mdonato-fn commented 1 year ago

I get this error after updating to 0.2.0

When I type td I see the workflow icon for a second and then it disappears.

This is what I get in the debug console. Is it on my side?

  File "/Users/mdfn/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.07A0B723-3BA2-462E-8BA3-55B2CD985F8D/alfred_mstodo_workflow.py", line 9, in <module>
    from mstodo.handlers.route import route
  File "/Users/mdfn/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.07A0B723-3BA2-462E-8BA3-55B2CD985F8D/mstodo/handlers/route.py", line 4, in <module>
    from mstodo import icons
  File "/Users/mdfn/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.07A0B723-3BA2-462E-8BA3-55B2CD985F8D/mstodo/icons.py", line 27, in <module>
    _icon_path = f"icons/{icon_theme()}/"
                          ^^^^^^^^^^^^
  File "/Users/mdfn/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.07A0B723-3BA2-462E-8BA3-55B2CD985F8D/mstodo/icons.py", line 18, in icon_theme
    prefs = Preferences.current_prefs()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdfn/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.07A0B723-3BA2-462E-8BA3-55B2CD985F8D/mstodo/models/preferences.py", line 52, in current_prefs
    cls._current_prefs = Preferences(wf.stored_data('prefs'))
                                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdfn/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.07A0B723-3BA2-462E-8BA3-55B2CD985F8D/workflow/workflow.py", line 1905, in stored_data
    raise ValueError(
ValueError: Unknown serializer `cpickle`. Register a corresponding serializer with `manager.register()` to load this data.
JiehoonKwak commented 1 year ago

same error T_T

johandebeurs commented 1 year ago

From the trace the error looks to be coming from the py3 fork of Alfred workflow. My guess is this is environment variable/python path related. Can you confirm which python version is available at /usr/bin/env python3?

mdonato-fn commented 1 year ago
Python 3.11.3 (main, Apr  7 2023, 19:25:52) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
johandebeurs commented 1 year ago

OK, I assume then contents of ~/Library/Application\ Support/Alfred/Workflow\ Data/com.johandebeurs.alfred.mstodo/.prefs.alfred-workflow are a single line with "cpickle"?

In the Py3 fork of alfred workflow, the registered serialisers are pickle and json: https://github.com/harrtho/alfred-pyworkflow/blob/7108611d50baf12a9fd6190975b38ac9ca334837/workflow/workflow.py#L623, as cpickle was removed in the Py2.7>Py3 https://stackoverflow.com/questions/56562929/modulenotfounderror-no-module-named-cpickle-on-python-3-7-3

Are you using a Py2.7 workflow elsewhere in Alfred that relies on Dean Jackson's older workflow? That version has cpickle as a possible serializer (ref https://www.deanishe.net/alfred-workflow/api/index.html#serializers) so my hunch is that this file is somehow higher in your PATH than the local workflow directory, and it is trying to read from that file instead.

What was your install method? Symlinked workflow or the one packaged with the release?

johandebeurs commented 1 year ago

Tested a bit more - looks like the solution is simply to do a full reset to remove the caches which use Py2.7 cpickle-based serialisation. Please run _td-full-reset and this will set you up for the new py3 workflow. I'll add this to the release notes for clarity and close this issue