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
Cairo Backend: Can't convert 'bytes' object to str implicitly on Python3 #2903
Comments
Looks like more side effects of the switch from 2to3 -> six. |
I would say that quick and dirty fix to ctx.show_text(s.decode()) makes the backend work correct. I am just not sure that fixing symptoms is a right thing. |
That seems like the correct fix to me. Can you put in a PR with that fix and we will see what @mdboom thinks. |
Can you provide a complete script that reproduces the problem? I'm not sure why bytes are getting in there in the first place -- I would have expected it to be Unicode all the way down. |
import matplotlib
matplotlib.use("cairo")
import matplotlib.pyplot as pp
if __name__ == "__main__":
figure = pp.figure("Test Cairo")
figure.clf()
main_axes = figure.add_axes([0, 0, 1, 1])
main_axes.cla()
figure.text(label="Test", s="100", x=0.1, y=0.9)
figure.canvas.draw()
pp.savefig("/tmp/test_cairo.png")
|
When trying to use "cairo" backend with text labels on Python3, I get
Other backends work fine. This seems to be a pretty typical bytes vs. str Python3 bug.
I have no cairocffi installed and cairo.version_info is (1, 10, 0).
The text was updated successfully, but these errors were encountered: