gcalcli icon indicating copy to clipboard operation
gcalcli copied to clipboard

--lineart unicode gives : TypeError: can only concatenate str (not "bytes") to str

Open matclab opened this issue 3 years ago • 1 comments

gcalcli --version                 
gcalcli v4.3.0 (Eric Davis, Brian Hartvigsen, Joshua Crowgey)

gcalcli --lineart unicode agenda  --detail description  
…
Traceback (most recent call last):
  File "/usr/bin/gcalcli", line 33, in <module>
    sys.exit(load_entry_point('gcalcli==4.3.0', 'console_scripts', 'gcalcli')())
  File "/usr/lib/python3.9/site-packages/gcalcli/cli.py", line 152, in main
    gcal.AgendaQuery(start=parsed_args.start, end=parsed_args.end)
  File "/usr/lib/python3.9/site-packages/gcalcli/gcal.py", line 1238, in AgendaQuery
    return self._display_queried_events(start, end)
  File "/usr/lib/python3.9/site-packages/gcalcli/gcal.py", line 1187, in _display_queried_events
    return self._iterate_events(start, event_list, year_date=year_date)
  File "/usr/lib/python3.9/site-packages/gcalcli/gcal.py", line 1056, in _iterate_events
    self._PrintEvent(event, prefix)
  File "/usr/lib/python3.9/site-packages/gcalcli/gcal.py", line 813, in _PrintEvent
    descr_indent +
TypeError: can only concatenate str (not "bytes") to str

matclab avatar Jan 27 '21 14:01 matclab

Changing Printers.ART_CHARS['unicode'] to

    'unicode': {
        'hrz': b'\xe2\x94\x80'.decode('utf8'),
        'vrt': b'\xe2\x94\x82'.decode('utf8'),
        'lrc': b'\xe2\x94\x98'.decode('utf8'),
        'urc': b'\xe2\x94\x90'.decode('utf8'),
        'ulc': b'\xe2\x94\x8c'.decode('utf8'),
        'llc': b'\xe2\x94\x94'.decode('utf8'),
        'crs': b'\xe2\x94\xbc'.decode('utf8'),
        'lte': b'\xe2\x94\x9c'.decode('utf8'),
        'rte': b'\xe2\x94\xa4'.decode('utf8'),
        'bte': b'\xe2\x94\xb4'.decode('utf8'),
        'ute': b'\xe2\x94\xac'.decode('utf8')},

seems to solve the problem.

matclab avatar Jan 27 '21 14:01 matclab