Merge pull request #294 from qedsoftware/fix-merger-fileobj

Fix PdfFileMerger for file objects on Python 3. Fixes #293
This commit is contained in:
Matthew Stamy 2017-01-04 20:20:05 -06:00 committed by GitHub
commit 2f6d2da565
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ class PdfFileMerger(object):
if isString(fileobj):
fileobj = file(fileobj, 'rb')
my_file = True
elif isinstance(fileobj, file):
elif hasattr(fileobj, "seek") and hasattr(fileobj, "read"):
fileobj.seek(0)
filecontent = fileobj.read()
fileobj = StreamIO(filecontent)