Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to update #80

Closed
yvangodard opened this issue Feb 21, 2022 · 7 comments
Closed

Error when trying to update #80

yvangodard opened this issue Feb 21, 2022 · 7 comments

Comments

@yvangodard
Copy link

Hi, after a first sync, I'm facing this issue when trying to re-sync :

Traceback (most recent call last):
File "/usr/local/bin/sync-ics2gcal", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/sync_ics2gcal/sync_calendar.py", line 49, in main
sync.prepare_sync(start)
File "/usr/local/lib/python3.7/dist-packages/sync_ics2gcal/sync.py", line 169, in prepare_sync
self._filter_events_to_update()
File "/usr/local/lib/python3.7/dist-packages/sync_ics2gcal/sync.py", line 79, in _filter_events_to_update
self.to_update = list(filter(filter_updated, self.to_update))
File "/usr/local/lib/python3.7/dist-packages/sync_ics2gcal/sync.py", line 75, in filter_updated
new_date = dateutil.parser.parse(new['updated'])
KeyError: 'updated'

What could be the reason ? Any idea to solve this issue ?

@b4tman
Copy link
Owner

b4tman commented Feb 21, 2022

Hi, @yvangodard. Looks like source ics file events don't have 'LAST-MODIFIED' field, that used to compare with 'updated' field on google calendar events.

I need to figure out how to handle such events, may be using 'CREATED' or 'DTSTART' fields, or just always overwrite it.

@yvangodard
Copy link
Author

Exactly, some events don't have LAST-MODIFIED field. For sure, always overwriting this type of events would be a solution.

b4tman added a commit that referenced this issue Feb 22, 2022
overwrite events without updated field (#80)
@b4tman
Copy link
Owner

b4tman commented Feb 22, 2022

@yvangodard I just pushed a fix to develop branch, please help test again!

@b4tman
Copy link
Owner

b4tman commented Feb 23, 2022

ModuleNotFoundError: No module named 'icalendar'

try:

poetry install

it will install dependencies in virtual environment.
then you can run:

poetry run sync-ics2gcal

@yvangodard
Copy link
Author

Thanks, I saw just after posting that I was trying to run without having install ...
Regard my tests it seems to work well.
Just an issue when trying to use a config start_from with a specific date :

Traceback (most recent call last):
File "", line 1, in
File "/home/ical2googlesync/sync-ics2gcal/sync_ics2gcal/sync_calendar.py", line 40, in main
start = get_start_date(config['start_from'])
File "/home/ical2googlesync/sync-ics2gcal/sync_ics2gcal/sync_calendar.py", line 27, in get_start_date
result = dateutil.parser.parse(date_str)
File "/root/.cache/pypoetry/virtualenvs/sync-ics2gcal--yUbY2jh-py3.7/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 1368, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/root/.cache/pypoetry/virtualenvs/sync-ics2gcal--yUbY2jh-py3.7/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 640, in parse
res, skipped_tokens = self._parse(timestr, **kwargs)
File "/root/.cache/pypoetry/virtualenvs/sync-ics2gcal--yUbY2jh-py3.7/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 719, in _parse
l = _timelex.split(timestr) # Splits the timestr into tokens
File "/root/.cache/pypoetry/virtualenvs/sync-ics2gcal--yUbY2jh-py3.7/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 201, in split
return list(cls(s))
File "/root/.cache/pypoetry/virtualenvs/sync-ics2gcal--yUbY2jh-py3.7/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 70, in init
'{itype}'.format(itype=instream.class.name))
TypeError: Parser must be a string or character stream, not datetime

@b4tman
Copy link
Owner

b4tman commented Feb 23, 2022

TypeError: Parser must be a string or character stream, not datetime

use quotes, like this:

start_from: '2018-04-03T13:23:25.000001Z'

i will fix it

@yvangodard
Copy link
Author

Everything seems to work perfectly now! Great! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants