Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

Fix for "TypeError: write() argument must be str, not bytes" on Python 3.8+#31

Open
dvoina wants to merge 1 commit into
tjfontaine:masterfrom
dvoina:patch-1
Open

Fix for "TypeError: write() argument must be str, not bytes" on Python 3.8+#31
dvoina wants to merge 1 commit into
tjfontaine:masterfrom
dvoina:patch-1

Conversation

@dvoina

@dvoina dvoina commented Mar 28, 2021

Copy link
Copy Markdown

As the output file is created for writing text and lxml raw generates bytes objects an error is thrown.
Opening the file in binary mode solves the issue.

…n 3.8

As the output file is created for writing text and lxml raw generates bytes objects an error is thrown. 
Opening the file in binary mode solves the issue.
@Zaoliang

Copy link
Copy Markdown

cool!
However I created the service file for avahi service already and it works without issue.
I verified your change, it creates correct service file for my hp printer :)

LGTM

@davygravy

Copy link
Copy Markdown

Just confirmed this patch as a solution for the bug.

@utopiabound utopiabound left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This fixes generation on Python 3.10

@ricardoamaro

Copy link
Copy Markdown

+1 for merging this @tjfontaine
Just tested it in python 3.8

@alehmann76

Copy link
Copy Markdown

Can confirm it as an solution for Python 3.6.8

@cookieBerlin cookieBerlin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

works for me, with python 3.9.2

@ricardoamaro

Copy link
Copy Markdown

@tjfontaine @superna9999 @rchenzheng any chance you could merge this, please?

@rchenzheng

Copy link
Copy Markdown
Contributor

@tjfontaine @superna9999 @rchenzheng any chance you could merge this, please?

Unfortunately I do not have write access.

@lukystreik

Copy link
Copy Markdown

works for me, please merge to main

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants