jspricke / remind-caldav

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

IndexError: string index out of range #16

Open PorcelainMouse opened 2 years ago

PorcelainMouse commented 2 years ago

Sorry, I'm still stuck.

$ rem2dav --zone America/Los_Angeles --startdate 2022-03-22 --month 1 --davuser <davuser> --davurl https://helm.<domain>:8443
Password: 
Traceback (most recent call last):
  File "/home/<username>/.local/bin/rem2dav", line 8, in <module>
    sys.exit(main())
  File "/home/<username>/.local/lib/python3.10/site-packages/rem2dav.py", line 126, in main
    calendar = Calendar(client, args.davurl)
  File "/home/<username>/.local/lib/python3.10/site-packages/caldav/objects.py", line 82, in __init__
    self.url = client.url.join(url)
  File "/home/<username>/.local/lib/python3.10/site-packages/caldav/lib/url.py", line 174, in join
    if path.path[0] == '/':
IndexError: string index out of range

Where , , and were redacted.

Also, I put my credentials in the keyring, and I can retrieve them with keyring and with code I see in rem2dav that does it, although I skipped some of the parsing and just passed strings to get_assword(). I'm assuming this is yet another issue, but thought I should mention it.

jspricke commented 2 years ago

$ rem2dav --zone America/Los_Angeles --startdate 2022-03-22 --month 1 --davuser --davurl https://helm.:8443

Usually the URL is a bit longer then just the domain, depending on the Caldav server. rem2dav is using the python-caldav library, see:

https://github.com/python-caldav/caldav/blob/master/docs/source/index.rst#some-notes-on-caldav-urls

Also, I put my credentials in the keyring, and I can retrieve them with keyring and with code I see in rem2dav that does it, although I skipped some of the parsing and just passed strings to get_assword(). I'm assuming this is yet another issue, but thought I should mention it.

Not sure I understand this, can you open a new issue once rem2dav works via password?

PorcelainMouse commented 2 years ago

Okay, so I talked to Helm, and they say most clients don't have a problem with the short URL. And, like I said, Etar app also accepted it. I guess I have to take that up with python-caldav?

I have also found another URL in the sync. But, I cannot get that to work either, but this time, the error says "400 Bad Request" and the HTML returned says "REPORT request body may not be empty". What do you make of this?

PorcelainMouse commented 2 years ago

Hmm, also, I see a bit about CalDAV URLs in the python-caldav README:

"CalDAV URLs can be quite confusing, some software requires the URL to the calendar, other requires the URL to the principal. The Python CalDAV library does support accessing calendars and principals using such URLs, but the recommended practice is to configure up the CalDAV root URL and tell the library to find the principal and calendars from that."

And then it lists https://caldav.icloud.com/ as one such URL. So, I wonder if rem2dav is "looking up the principle and calendars". Sounds more difficult, but would be convenient, since the other URL I tried has a UUID in it and was difficult to copy by eye. Maybe rem2dav requires the calendar URL, specifically. But, maybe that isn't the main issue. I was able to find what I think is my user's calendar URL.

jspricke commented 2 years ago

And, like I said, Etar app also accepted it.

Just to say, Etar only shows the calendar, it has nothing to do with CalDAV. You may mean DAVx5.

I think I used the URL to the calendar last time I tried but that is some years ago, I only use https://github.com/jspricke/radicale-remind these days. Given that this Could be different depending on the CalDAV server I'm not sure how I could help.

PorcelainMouse commented 2 years ago

Hmm, yes, you are right about Etar. I guess I synced it with another tool, but of course that tool took the "root" URL, and didn't require my personal calendar URL; it discovered my calendar URL from the server. I'm not sure what the "principle" URL is, but there seems to be three different URLs at play, and python-caldav says it should work with the "root" URL, but the client must query the server to get the actual "calendar" URL.

But, what I'm saying is, that rem2dav requires this third, most specific URL, which I think is called the calendar URL, not the CalDAV server "root" URL. Is that accurate?

Secondly, you can help me by interpreting the 400 Bad Request error. Let's assume I have the right URL now, yet rem2dav still isn't working. Can we see what rem2dav tried to send to the CalDAV server? The server says the request was "empty". That should be easy to verify, no?

jspricke commented 2 years ago

But, what I'm saying is, that rem2dav requires this third, most specific URL, which I think is called the calendar URL, not the CalDAV server "root" URL. Is that accurate?

I think so, yes.

Secondly, you can help me by interpreting the 400 Bad Request error. Let's assume I have the right URL now, yet rem2dav still isn't working. Can we see what rem2dav tried to send to the CalDAV server? The server says the request was "empty". That should be easy to verify, no?

Assuming you have some experience with Python, you can check what is send here:

https://github.com/jspricke/remind-caldav/blob/master/rem2dav.py#L148

jspricke commented 2 years ago

And, like I said, Etar app also accepted it.

Just to say, Etar only shows the calendar, it has nothing to do with CalDAV. You may mean DAVx5.

I think I used the URL to the calendar last time I tried but that is some years ago, I only use https://github.com/jspricke/radicale-remind these days. Given that this Could be different depending on the CalDAV server I'm not sure how I could help.

PorcelainMouse commented 2 years ago

Thanks for your help. I'm too busy to work on it, but I've not given up, yet. This is a big problem for me, but I don't have time to try to figure it out.

I want to stand up radicale, too, so maybe that is the way to go. Might be faster. I just have CalDAV working already and thought bringing in remind would be the best way to go, but maybe that's wrong. Seems like you like radicale.

jspricke commented 2 years ago

Oh wow, I send the last mail in March no idea where it got stuck, sorry.

Do you have an example account on your server so I can try myself?

You could also try curl, something like this should work:

curl -u user:password -T calendar.ics "http://localhost:5232/user/.reminders/"
PorcelainMouse commented 2 years ago

yeah, I could give you an account to play with, if you want. I don't want you to have to do that, but it's easy.

Maybe I can try your curl trick. Should I be able to fetch 'calendar.ics' file from the same URL? Maybe I can just see what's there, first.

jspricke commented 2 years ago

Feel free to send me the data via mail, I would be happy to test that.

Should I be able to fetch 'calendar.ics' file from the same URL?

You should use the same URL as you tried with remind-caldav. Btw. did you try dav2rem?

PorcelainMouse commented 2 years ago

Hmm, I forget if I tried dev2rem; I don't think so.