From 08b74fe616af7d58810d2951b5bcc674fde0ef99 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 25 Aug 2016 15:47:34 -0300 Subject: [PATCH 1/2] Python3 unicode In python3 we do not have unicode strings, so we do not need to decode them. --- scraperwiki/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scraperwiki/utils.py b/scraperwiki/utils.py index 4e76115..55b3de6 100644 --- a/scraperwiki/utils.py +++ b/scraperwiki/utils.py @@ -57,7 +57,12 @@ def pdftoxml(pdfdata, options=""): #xmlfin = open(tmpxml) xmldata = xmlin.read() xmlin.close() - return xmldata.decode('utf-8') + try: + xmldata = xmldata.decode('utf-8') + except AttributeError: + pass + + return xmldata.d def _in_box(): From 3b99d64c404914de5fd7ea2ca1122d93908bfb10 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 25 Aug 2016 15:52:45 -0300 Subject: [PATCH 2/2] Update utils.py --- scraperwiki/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scraperwiki/utils.py b/scraperwiki/utils.py index 55b3de6..4a04cb7 100644 --- a/scraperwiki/utils.py +++ b/scraperwiki/utils.py @@ -62,7 +62,7 @@ def pdftoxml(pdfdata, options=""): except AttributeError: pass - return xmldata.d + return xmldata def _in_box():