Use unicode_literal w/ bytestring comparison to detect failed PDF parsing again

This commit is contained in:
Roberto Rosario
2015-01-27 21:12:51 -04:00
parent 8ef7cb7d8b
commit 5bed264c81

View File

@@ -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')