pdfkit - python : 'str' object has no attribute decode <p>I am attempting to use pdfkit to convert string html to a pdf file. This is what I am doing</p> <pre><code> try: options = { 'page-size': 'A4', 'margin-top': '0.75in', 'margin-right': '0.75in', 'margin-bottom': '0.75in', 'margin-left': '0.75in', } config = pdfkit.configuration(wkhtmltopdf="/usr/local/bin/wkhtmltopdf") str= "Hello!!" pdfkit.from_string(str,"Somefile.pdf",options=options,configuration=config) return HttpResponse("Works") except Exception as e: return HttpResponse(str(e)) </code></pre> <p>however at <code>from_string</code> I get the exception 'str' object has no attribute decode. Any suggestions on how I can fix this ? I am using Python 3.5.1</p>