[Python-modules-team] Bug#942394: python3-icalendar: python3 cli.py view not working due to an str/byte issue

Hermann Lauer Hermann.Lauer at iwr.uni-heidelberg.de
Tue Oct 15 16:17:23 BST 2019


Package: python3-icalendar
Version: 4.0.3-2
Severity: normal
Tags: patch

Dear Maintainer,

$ python3 -m icalendar.cli view /tmp/test.ics
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/icalendar/cli.py", line 111, in <module>
    main()
  File "/usr/lib/python3/dist-packages/icalendar/cli.py", line 104, in main
    args.func(**{k: v for k, v in vars(args).items()
  File "/usr/lib/python3/dist-packages/icalendar/cli.py", line 74, in view
    description=event.get('description', '')).encode('utf-8'))
TypeError: write() argument must be str, not bytes

removing the encode(...) part makes it working, patch is appended.

Additionally:

$ python3 -m icalendar.cli
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/icalendar/cli.py", line 111, in <module>
    main()
  File "/usr/lib/python3/dist-packages/icalendar/cli.py", line 104, in main
    args.func(**{k: v for k, v in vars(args).items()
AttributeError: 'Namespace' object has no attribute 'func'

Expected is a meaningfull error/help message, but my python3 argsparse skills are not good
enough to propose a good solution.

Thanks,
 greetings
  Hermann

-- System Information:
Debian Release: 10.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-6-amd64 (SMP w/6 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-icalendar depends on:
ii  python3           3.7.3-1
ii  python3-dateutil  2.7.3-3
ii  python3-tz        2019.1-1

python3-icalendar recommends no packages.

python3-icalendar suggests no packages.

-- no debconf information
-------------- next part --------------
--- /usr/lib/python3/dist-packages/icalendar/cli.py	2018-10-10 09:41:19.000000000 +0200
+++ /tmp/cli.py	2019-10-15 17:15:15.805478145 +0200
@@ -71,7 +71,7 @@
             time_to=datetime.strftime(event.get('dtend').dt, '%H:%M'),
             location=event.get('location', ''),
             comment=event.get('comment', ''),
-            description=event.get('description', '')).encode('utf-8'))
+            description=event.get('description', '')))
 
 
 def main():


More information about the Python-modules-team mailing list