From 02642715c88eb10cab16153129d653d546d1a502 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Thu, 12 Sep 2019 08:26:39 +0000 Subject: python3 compatibility fix --- calendar-cli.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'calendar-cli.py') diff --git a/calendar-cli.py b/calendar-cli.py index 1b531db..6955704 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -162,6 +162,9 @@ def _calendar_addics(caldav_conn, ics, uid, args): try: c = find_calendar(caldav_conn, args) + ## unicode strings vs byte strings is a minefield in python3 ... so, re.search demands a string here ... + if hasattr(ics, 'decode'): + ics = ics.decode('utf-8') if re.search(r'^METHOD:[A-Z]+[\r\n]+',ics,flags=re.MULTILINE) and args.ignoremethod: ics = re.sub(r'^METHOD:[A-Z]+[\r\n]+', '', ics, flags=re.MULTILINE) print ("METHOD property found and ignored") -- cgit v1.2.3