From 6b0cc397a038599ef3737a4f6441ec96d4a8d0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= Date: Mon, 11 Dec 2017 15:13:10 +0100 Subject: [PATCH] Decode subprocess output When export fails the output should be messaged to the user. This however did not work on Python 3 because the result of p.communicate() is a tuple of bytes and join() expects strings. This lead to the error: TypeError: sequence item 0: expected str instance, bytes found --- ftplugin/orgmode/plugins/Export.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ftplugin/orgmode/plugins/Export.py b/ftplugin/orgmode/plugins/Export.py index d18f415f..2b2d1d9d 100644 --- a/ftplugin/orgmode/plugins/Export.py +++ b/ftplugin/orgmode/plugins/Export.py @@ -81,7 +81,9 @@ def _export(cls, format_): p.wait() if p.returncode != 0 or settings.get(u'org_export_verbose') == 1: - echom('\n'.join(p.communicate())) + echom('\n'.join(map( + lambda x: x.decode('utf-8'), + p.communicate()))) return p.returncode @classmethod