jspricke / remind-caldav

CalDAV client to sync to Remind
GNU General Public License v3.0
26 stars 7 forks source link

Problem Syncing #3

Open steview2000 opened 6 years ago

steview2000 commented 6 years ago

Hello, I use remind-caldav for quite a while now to sync my remind-calendar with a caldav server without any problems.

However, I recently got a new computer and reinstalled remind-caldav using pip. However with the latest version, I always get the following error:

Traceback (most recent call last): File "${HOME}/.local/bin/rem2dav", line 11, in sys.exit(main()) File "${HOME}/.local/lib/python2.7/site-packages/rem2dav.py", line 112, in main ncal.add(ldict[uid]) File "${HOME}/.local/lib/python2.7/site-packages/card_me/base.py", line 550, in add name = objOrName.upper() File "${HOME}/.local/lib/python2.7/site-packages/vobject/base.py", line 531, in getattr raise AttributeError(name) AttributeError: upper

The OS is Debian stretch. I tried various things, such as installing python-vobject and python-caldav from the Debian repositories which has older versions than what comes with pip. However, the error is the same. I'm surprised why vobject is needed, since I thought card_me is a fork of vobject.

Thanks in advance.

jspricke commented 6 years ago

Hi,

this sounds surprising, indeed. I just pushed a commit to switch back to the vobject library, could you test it? (clone git, install using setuptools, ping me if you need help).

Also, could you maybe share a minimal remind input to reproduce the error?

Cheers Jochen

steview2000 commented 6 years ago

Things are very weird. Here is what I did:

  1. Removing all vobject and python-caldav that where installed with pip (pip uninstall ...)
  2. Install python-caldav (0.4.) and python-vobject (0.9.3-3) from Debian repository
  3. Now, inside the folder 'remind-caldav' <python setup.py install --user> gave the error that 'python-vobject' where not found.
  4. Therefore, I changed the corresponding entry in setup.py from 'python-vobject' to 'vobject'. After that remind-caldav could be installed.
  5. Trying to sync my standard calendar file gives now a different error:

Traceback (most recent call last): File ${HOME}/.local/bin/rem2dav", line 11, in load_entry_point('remind-caldav==0.6.0', 'console_scripts', 'rem2dav')() File "build/bdist.linux-x86_64/egg/rem2dav.py", line 113, in main File ${HOME}/.local/lib/python2.7/site-packages/caldav/objects.py", line 435, in add_event return Event(self.client, data = ical, parent = self).save() File ${HOME}/.local/lib/python2.7/site-packages/caldav/objects.py", line 793, in save self._create(self._instance.serialize(), self.id, path) File ${HOME}/.local/lib/python2.7/site-packages/caldav/objects.py", line 779, in _create raise error.PutError(errmsg(r)) caldav.lib.error.PutError: 409 Conflict

  1. I created a minimal remind file (see below): birthdays.txt

This file works when the 2nd line is commented out, but does not work when the 2nd line is included.

I do have another laptop with an almost identical installation, where things work flawless. I checked there and there are multiple versions of vobject (0.9.3 and 0.9.4) and python-caldav installed. So my feeling is that with the correct combination certain versions of the libraries things work. When I have time, I will continue investigating.

Btw, dav2rem.py works without problems.

jspricke commented 6 years ago

Thanks for investigating this!

  1. Install python-caldav (0.4.) and python-vobject (0.9.3-3) from Debian repository

Could you try the current versions from pip instead?

  1. Now, inside the folder 'remind-caldav' <python setup.py install --user> gave the error that 'python-vobject' where not found.

Fixed, thanks!

  1. I created a minimal remind file (see below): birthdays.txt

I tested this and had no errors. Can you check if it works if you change the second line a bit, say the date or name?

steview2000 commented 6 years ago

Alright, first of all I get different error messages depending whether I install remind-caldav with "pip" or via the python setup script. However, with the example file it works in both cases when I change the date, such that the day has two digits. "REM Jan 13 +1 MSG Geburtstag Catherine" works and also "REM Jan 03 +1 MSG Geburtstag Catherine" but "REM Jan 3 +1 MSG Geburtstag Catherine" does not.

Surprisingly no problem occurs when the date in the first line has only a single digit.

jspricke commented 6 years ago

Ok, this sounds strange. First of all, what do you use as your caldav server?

Does it work when you only change the part after the MSG?

My guess is that we have a UID conflict somehow. Can you use curl or something to dump all your entries on the caldav and rem2ics to find if the UID is there twice?

steview2000 commented 6 years ago

My caldav server: https://dav.mailbox.org/caldav

It works when I alter the message somehow, like changing "Catherine" to "Catherin" - quite funny.

I don't know how to use curl to see UID conflict, but I think there is non, since I cleaned the how calendar on the server, so that it has no entries and the problem remains. My feeling is that for some strange reason, certain uid causes problems - maybe a problem in python-caldav?

jspricke commented 6 years ago

This sounds definitely like a problem with the UID, with is autogenerated by remind.

Have a look here for some curl commands:

https://stackoverflow.com/a/23093656

You could get the UID of the problematic even using:

echo "REM Jan 3 +1 MSG Geburtstag Catherine" | rem2ics -

steview2000 commented 6 years ago

Thanks, now I know the uid. But I don't think that the uid collides with an already existing uid on the server, since I also emptied the whole calendar on the server.

My guess is, that for some reasons the generated uid is rejected by the server for other reasons. I deleted all calendars and created new calendars. The result was, that I could sync to one of the calendars without problems, but not to two others, although the settings were the same.

However, from another computer (with the same version of Debian) things work well. The difference is of course that the uid contains the computer name. Also the uid changes when I make slight changes to the entry in the remind file.

This is a bit annoying for me, but so far it is sufficient to sync only from one computer since I use predominatly remind and syncronize the remind file via Dropbox.

Anyhow, since the problem is either with my server or with the remind-python library, this is not an issue with rem2dav and we can stop wasting our time. If I find time I might look into it again and in case I figure something new out I will post it here.

So, thanks again for your support and keep up the good work!

jspricke commented 6 years ago

Thanks again for your feedback, I agree that it's probably the server (maybe they cache old UIDs or something). In principal we could catch the PutError and try to work around it by changing the UID or trying to force a deletion (not sure how). But this sounds more like a hack. So let's just keep this open for others to find.