Skip to content

"errorMessage": "__str__ returned non-string (type bytes)" when printing ComputerGroup object #97

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

Closed
rodgerramjet26 opened this issue May 13, 2020 · 0 comments · Fixed by #98

Comments

@rodgerramjet26
Copy link

When trying to print a computer group object I got the error:
"errorMessage": "__str__ returned non-string (type bytes)"

As per this comment on https://stackoverflow.com/questions/15304229/convert-python-elementtree-to-string:

In Python 3, encoding='utf8' returns a bytestring instead of a string. I recommend using tostring(xml, encoding="unicode") instead. – Stevoisiak Feb 7 '18 at 19:18

So I believe you need to change line 159 in tools.py from:
return ElementTree.tostring(pretty_data, encoding='UTF-8')
to
return ElementTree.tostring(pretty_data, encoding='unicode')

I did this locally and it fixed the error for me.

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 a pull request may close this issue.

1 participant