tjfontaine / airprint-generate

Automatically generate AirPrint Avahi service files for CUPS printers
http://www.atxconsulting.com/blog/tjfontaine/2010/11/21/automatically-generate-airprint-avahi-service-files-cups-printers
400 stars 119 forks source link

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

Open dvoina opened 3 years ago

dvoina commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Just confirmed this patch as a solution for the bug.

ricardoamaro commented 2 years ago

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

alehmann76 commented 1 year ago

Can confirm it as an solution for Python 3.6.8

ricardoamaro commented 1 year ago

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

rchenzheng commented 1 year ago

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

Unfortunately I do not have write access.

lukystreik commented 9 months ago

works for me, please merge to main