pimutils / vdirsyncer

📇 Synchronize calendars and contacts.
https://vdirsyncer.pimutils.org/
Other
1.53k stars 160 forks source link

Google Calendar Discovering Failure #525

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello,

I'm trying to sync my google calendar using the tutorial. During the discovering process my browser is opened and google asked me if I want to allow vdirsyncer to manage my calendar. So I click yes, and then it a code is displayed, vdirsyncer is waiting for me to paste it in it and so I do. Then I get an error message:

error: Unknown error occured: [Errno 2] No such file or directory: '$XDG_CONFIG_HOME/vdirsyncer/tmp9i23du_6'
error: Use `-vdebug` to see the full traceback.
error: 1 out of 1 tasks failed.

With -vdebug:

Paste obtained code: 4/Zfe9VJEMnguU5dGLO6Xdf1nQcBthja76FOcPlL9uvJI
error: Unknown error occured: [Errno 2] No such file or directory: '$XDG_CONFIG_HOME/vdirsyncer/tmppi19g2g5'
error: Use `-vdebug` to see the full traceback.
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/cli/utils.py", line 518, in _worker
debug:     func(wq=self)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/cli/tasks.py", line 88, in discover_collections
debug:     rv = collections_for_pair(pair=pair, **kwargs)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/cli/utils.py", line 220, in collections_for_pair
debug:     list_collections=list_collections))
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/cli/utils.py", line 332, in _collections_for_pair_impl
debug:     a_discovered = _discover_from_config(pair.config_a)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/cli/utils.py", line 268, in _discover_from_config
debug:     return handle_storage_init_error(cls, config)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/cli/utils.py", line 264, in _discover_from_config
debug:     discovered.extend(cls.discover(**config))
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/storage/dav.py", line 400, in discover
debug:     session, _ = cls.session_class.init_and_remaining_args(**kwargs)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/storage/dav.py", line 319, in init_and_remaining_args
debug:     return cls(**self_args), remainder
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/storage/google.py", line 45, in __init__
debug:     ui_worker.put(f)
debug:   File "/usr/lib/python3.5/site-packages/click_threading/__init__.py", line 81, in put
debug:     return future.result()
debug:   File "/usr/lib/python3.5/concurrent/futures/_base.py", line 405, in result
debug:     return self.__get_result()
debug:   File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
debug:     raise self._exception
debug:   File "/usr/lib/python3.5/site-packages/click_threading/__init__.py", line 66, in run
debug:     result = func()
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/storage/google.py", line 44, in <lambda>
debug:     f = lambda: self._init_token(token_file, client_id, client_secret)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/storage/google.py", line 94, in _init_token
debug:     _save_token(token)
debug:   File "/usr/lib/python3.5/site-packages/vdirsyncer/storage/google.py", line 56, in _save_token
debug:     with atomic_write(token_file, mode='w', overwrite=True) as f:
debug:   File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.5/site-packages/atomicwrites/__init__.py", line 149, in _open
debug:     with get_fileobject() as f:
debug:   File "/usr/lib/python3.5/site-packages/atomicwrites/__init__.py", line 166, in get_fileobject
debug:     delete=False, **kwargs)
debug:   File "/usr/lib/python3.5/tempfile.py", line 549, in NamedTemporaryFile
debug:     (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
debug:   File "/usr/lib/python3.5/tempfile.py", line 260, in _mkstemp_inner
debug:     fd = _os.open(file, flags, 0o600)
error: 1 out of 1 tasks failed.

I use vdirsyncer 0.14.0-1 installer on Archlinux from Aur repository, reading the debug log I guess it runs Python version 3.5.

And here is my config file:

[general]
status_path = "$XDG_CONFIG_HOME/vdirsyncer/status/"

[pair google_calendar]
a = "google_calendar_remote"
b = "google_calendar_local"
collections = ["me@gmail.com"]
conflict_resolution = "a wins"

[storage google_calendar_remote]
type = "google_calendar"
token_file = "$XDG_CONFIG_HOME/vdirsyncer/token_file"
client_id = secret
client_secret = secret
#start_date = null
#end_date = null
#item_types = []

[storage google_calendar_local]
type = "filesystem"
path = "$XDG_CONFIG_HOME/google/"
fileext = ".ics"

And $XDG_CONFIG_HOME is set.

geier commented 7 years ago

vdirsyncer does not expand environment variables. Hard coding the path should work fine.

ghost commented 7 years ago

Fine, it works. Thank you. It may not be the right place to ask so I will move my post if it bothers, but now I don't understand why there isn't any event in khal when I open it. I have run vdirsyncer sync and the .calendars/google/ direcory contain a directory with my mail address containing *.ics files. Here is my vdirsyncer config:

[general]
status_path = "/home/focal/.config/vdirsyncer/status/"

[pair google_calendar]
a = "google_calendar_remote"
b = "google_calendar_local"
collections = ["nicolas.scottod@gmail.com"]
conflict_resolution = "a wins"

[storage google_calendar_remote]
type = "google_calendar"
token_file = "/home/focal/.config/vdirsyncer/token_file"
client_id = "xxx"
client_secret = "xxx"
#start_date = null
#end_date = null
#item_types = []

[storage google_calendar_local]
type = "filesystem"
path = "/home/focal/.calendars/google/"
fileext = ".ics"

And here is my khal.conf:

[calendars]
[[google]]
path = ~/.calendars/google/

[locale]
local_timezone= Europe/Paris
default_timezone= Europe/Paris
timeformat= %H:%M
dateformat= %d.%m.
longdateformat= %d.%m.%Y
datetimeformat= %d.%m. %H:%M
longdatetimeformat= %d.%m.%Y %H:%M
untitaker commented 7 years ago

You need to change the path from ~/.calendars/google/ to that directory that is equal to your email address. Khal wants the path to the folder that directly contains the ICS files.

ghost commented 7 years ago

Than you!