From 5bed264c81adafc5b48979aa0d27c46672b9c04f Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 27 Jan 2015 21:12:51 -0400 Subject: [PATCH] Use unicode_literal w/ bytestring comparison to detect failed PDF parsing again --- mayan/apps/ocr/parsers/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mayan/apps/ocr/parsers/__init__.py b/mayan/apps/ocr/parsers/__init__.py index 5e321bfb6c..0f0673f4d2 100644 --- a/mayan/apps/ocr/parsers/__init__.py +++ b/mayan/apps/ocr/parsers/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import logging import os import slate @@ -87,7 +89,7 @@ class SlateParser(Parser): pdf_pages = slate.PDF(descriptor) descriptor.close() - if pdf_pages[document_page.page_number - 1] == '\x0c': + if pdf_pages[document_page.page_number - 1] == b'\x0c': raise ParserError document_page.content = pdf_pages[document_page.page_number - 1] @@ -163,7 +165,7 @@ class PopplerParser(Parser): raise ParserError output = proc.stdout.read() - if output == '\x0c': + if output == b'\x0c': logger.debug('Parser didn\'t any output') raise ParserError('No output')