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

Failure of encoding detection on Python2 causes hard to debug termination #331

Closed
nedbat opened this issue Oct 20, 2014 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Oct 20, 2014

Originally reported by Anonymous


in the case that someone moves the default coding line down a few lines,
on python2 ascii is detected instead of utf-8, therefore coverage fails flat when decoding

i was only able to find the problem by adding a comment in coverages html reporting at the end of the html_file method right before the html = html.decode(encoding) line


@nedbat
Copy link
Owner Author

nedbat commented Oct 20, 2014

The encoding declaration must be on the first or second line of the file. This is according to PEP 263: http://legacy.python.org/dev/peps/pep-0263/

Can you provide a reproducible test case that demonstrates the problem? I'll reopen the ticket then.

Thanks.

@nedbat
Copy link
Owner Author

nedbat commented Oct 20, 2014

The author contacted me on IRC to say, "the problem was mostly that the error left no way to figure what file it broke on."

@nedbat
Copy link
Owner Author

nedbat commented Dec 28, 2014

This was fixed in 529fef3d32ab (bb). Encoding errors now don't break the HTML report at all.

@nedbat nedbat closed this as completed Dec 28, 2014
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant