Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode subprocess output #287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nyoxi
Copy link

@nyoxi nyoxi commented Dec 11, 2017

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

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
@codecov-io
Copy link

Codecov Report

Merging #287 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #287   +/-   ##
=======================================
  Coverage   84.38%   84.38%           
=======================================
  Files          49       49           
  Lines        6794     6794           
=======================================
  Hits         5733     5733           
  Misses       1061     1061
Impacted Files Coverage Δ
ftplugin/orgmode/plugins/Export.py 33.82% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce17a40...6b0cc39. Read the comment docs.

Copy link
Contributor

@akstrfn akstrfn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use u_decode function from here.

@@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use u_decode function from here.

So something like map(u_decode, p.communicate())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants