Use unicode_literal w/ bytestring comparison to detect failed PDF parsing again
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user