Skip to content

Commit

Permalink
Python2 backport
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei committed Dec 26, 2020
1 parent c4d5a4d commit c959407
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python-combinepdf.py
Expand Up @@ -14,7 +14,7 @@
"""

from argparse import ArgumentParser
import contextlib
import contextlib2
import PyPDF2


Expand All @@ -35,7 +35,7 @@ def main():

# Workaround for PyPDF2 empty output file: keep input files open
# See https://stackoverflow.com/a/49927541/336802
with contextlib.ExitStack() as stack:
with contextlib2.ExitStack() as stack:
pdfMerger = PyPDF2.PdfFileMerger()
files = [stack.enter_context(open(pdf, 'rb')) for pdf in args.files]
for f in files:
Expand Down

0 comments on commit c959407

Please sign in to comment.