aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf/utils.py')
-rw-r--r--wkhtmltopdf/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index 87b214c..3d125bb 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -98,10 +98,11 @@ def wkhtmltopdf(pages, output=None, **kwargs):
list(pages),
[output]))
ck_kwargs = {'env': env}
+ # Handling of fileno() attr. based on https://github.com/GrahamDumpleton/mod_wsgi/issues/85
try:
i = sys.stderr.fileno()
ck_kwargs['stderr'] = sys.stderr
- except AttributeError:
+ except (AttributeError, IOError):
# can't call fileno() on mod_wsgi stderr object
pass
@@ -185,7 +186,7 @@ def http_quote(string):
if isinstance(string, six.text_type):
try:
import unidecode
- string = unidecode.unidecode(string)
+ string = bytes(unidecode.unidecode(string), 'ascii')
except ImportError:
string = string.encode('ascii', 'replace')
# Wrap in double-quotes for ; , and the like