UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 28: invalid start byte
See original GitHub issueLatest release has introduced a new bug (this same code worked on 0.5.0)
File "/usr/local/lib/python3.5/dist-packages/pdfkit/api.py", line 72, in from_string
return r.to_pdf(output_path)
File "/usr/local/lib/python3.5/dist-packages/pdfkit/pdfkit.py", line 146, in to_pdf
if 'cannot connect to X server' in stderr.decode('utf-8'):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 28: invalid start byte
Issue Analytics
- State:
- Created 7 years ago
- Reactions:12
- Comments:6 (1 by maintainers)
Top Results From Across the Web
error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff ...
When it tries this, it encounters a byte sequence which is not allowed in utf-8-encoded strings (namely this 0xff at position 0).
Read more >Python UnicodeDecodeError utf-8 codec can t decode byte ...
utf-8 ' codec can't decode byte 0xa0 in position 10: invalid start byte. my code import wordcloud import numpy as np from matplotlib...
Read more >How to fix error UnicodeDecodeError utf 8 codec cant decode ...
How to Fix Error "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte" in Python. The below error is...
Read more >'utf-8' codec can't decode byte 0xff in position 0 | bobbyhadz
The Python "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte" occurs when we specify an incorrect ...
Read more >'utf-8' codec can't decode byte 0xfe in position 341
Find professional answers about "'utf-8' codec can't decode byte 0xfe in position 341: invalid start byte" in 365 Data Science's Q&A Hub. Join...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Getting the same error. pdfkit==0.6.1
I can definitely confirm that this issue still persists in version 0.6.1. I tried it in a clean docker environment. In order to reproduce this error, the following command is enough:
pdfkit.from_string('<html></html>', False).to_pdf(False).decode()
. This leads to:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 785: invalid start byte
@JazzCore do you have any idea why this is?
Update Downgrading to 0.5.0 also did not lead to success
If I look at the file I can see that there are a lot of non-byte-characters at the beginning which seem to be the shell output of the executed command:
Okay, this can be suppressed by using the
'quiet'
option. However, this doesn’t solve the problem either.Update Using
decode(errors='ignore')
works…