vdirsyncer icon indicating copy to clipboard operation
vdirsyncer copied to clipboard

google_calendar discover fails with missing import

Open djpohly opened this issue 7 years ago • 3 comments

Looks like this was probably caused by commit 04b6913, since that's where prepare_verify was removed.

vdirsyncer git ac45cf1, Python 3.7.0, Linux (Arch)

Config file:

[general]
status_path = "~/.local/share/vdirsyncer/status/"

[storage cal_local]
type = "filesystem"
path = "~/docs/calendar"
fileext = ".ics"

[storage cal_google]
type = "google_calendar"
token_file = "~/.local/share/vdirsyncer/token_google"
client_id = "redacted"
client_secret = "redacted"

[pair google]
a = "cal_local"
b = "cal_google"
conflict_resolution = "b wins"
collections = [["Google", "Google", "[email protected]"]]
metadata = ["color"]

Output of vdirsyncer -vdebug discover:

error: Unknown error occurred: cannot import name 'prepare_verify' from 'vdirsyncer.http' (/usr/lib/python3.7/site-packages/vdirsyncer/http.py)
error: Use `-vdebug` to see the full traceback.
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/utils.py", line 342, in _worker
debug:     func(wq=self)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/tasks.py", line 82, in discover_collections
debug:     rv = collections_for_pair(pair=pair, **kwargs)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/discover.py", line 65, in collections_for_pair
debug:     b_discovered = _DiscoverResult(pair.config_b)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/discover.py", line 129, in __init__
debug:     self._cls, _ = storage_class_from_config(config)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/utils.py", line 250, in storage_class_from_config
debug:     cls = storage_names[storage_name]
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/utils.py", line 48, in __getitem__
debug:     mod = importlib.import_module(modname)
debug:   File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
debug:     return _bootstrap._gcd_import(name[level:], package, level)
debug:   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
debug:   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
debug:   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
debug:   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
debug:   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
debug:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/storage/google.py", line 14, in <module>
debug:     from . import base, olddav as dav
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/storage/olddav.py", line 15, in <module>
debug:     from ..http import USERAGENT, prepare_auth, \
error: 1 out of 1 tasks failed.

djpohly avatar Sep 11 '18 17:09 djpohly

I've got a similar problem error: Unknown error occurred: cannot import name 'prepare_verify' from 'vdirsyncer.http' (/nix/store/xxg38w6cksa2idlsn4vyr3li4f2118gv-vdirsyncer-unstable-2018-08-05/lib/python3.7/site-packages/vdirsyncer/http.py)

teto avatar Jan 16 '19 07:01 teto

Would it be possible to have a new release fixing this please ? I can't sync my calendars anymore :'(

teto avatar Feb 03 '19 09:02 teto

This can be fixed by removing the import of prepare_verify and copying its definition from the commit mentioned by @djpohly (04b6913f65dcdbf2cecb34db1bb2973c2f19dc36) into the olddav.py file. I'm not familiar with the code so this is probably pretty dirty—but it works for me. I will prepare a quick pull request for this.

dpaetzel avatar Feb 20 '19 12:02 dpaetzel