summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2019-09-12 08:26:39 +0000
committerTobias Brox <tobias@redpill-linpro.com>2019-09-12 08:26:39 +0000
commit02642715c88eb10cab16153129d653d546d1a502 (patch)
tree80d0e67610fba2653823ca23a49c492df8f444e1
parent831e7ec5e909c222f447d885eaaabeb62bc0080a (diff)
downloadcalendar-cli-02642715c88eb10cab16153129d653d546d1a502.zip
python3 compatibility fix
-rwxr-xr-xcalendar-cli.py3
1 files changed, 3 insertions, 0 deletions
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")