Bug 1733794 - pdfbook2 TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Summary: pdfbook2 TypeError: startswith first arg must be bytes or a tuple of bytes, n...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: texlive-base
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-28 17:10 UTC by Mildred
Modified: 2020-01-19 01:00 UTC (History)
2 users (show)

Fixed In Version: texlive-base-20190410-7.fc31 texlive-base-20180414-36.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-13 02:20:03 UTC


Attachments (Terms of Use)

Description Mildred 2019-07-28 17:10:45 UTC
Description of problem:

pdfbook2 fails with the following error:

Processing Kyriale_totum_A4.pdf
Getting bounds... Traceback (most recent call last):
  File "/usr/bin/pdfbook2", line 237, in <module>
    booklify( arg, opts )
  File "/usr/bin/pdfbook2", line 57, in booklify
    bboxes = [s[len( bboxName ) + 1:] for s in lines if s.startswith( bboxName )]
  File "/usr/bin/pdfbook2", line 57, in <listcomp>
    bboxes = [s[len( bboxName ) + 1:] for s in lines if s.startswith( bboxName )]
TypeError: startswith first arg must be bytes or a tuple of bytes, not str



Version-Release number of selected component (if applicable): texlive-pdfbook2-20180414-35.fc30.noarch


How reproducible: always


Steps to Reproduce:
1. Download http://www.musique-liturgique.com/wp-content/uploads/2012/04/Kyriale_totum_A4.pdf or try other PDF documents
2. Run pdfbook2 Kyriale_totum_A4.pdf
3. Watch the error

Actual results: the error


Expected results: no error


Additional info: looks like a python3 compatibility issue. A similar problem seems to be found in https://github.com/jsvine/pdfplumber/issues/33

The following fix seems to fix the issue:

diff -u /usr/bin/pdfbook2.old /usr/bin/pdfbook2   
--- /usr/bin/pdfbook2.old	2019-07-28 19:09:55.154982370 +0200
+++ /usr/bin/pdfbook2	2019-07-28 19:02:14.402250589 +0200
@@ -37,7 +37,7 @@
     sys.stdout.flush()
 
     #---------------------------------------------------------- useful constants
-    bboxName = "%%HiResBoundingBox:"
+    bboxName = b"%%HiResBoundingBox:"
     tmpFile = ".crop-tmp.pdf"
 
     #------------------------------------------------- find min/max bounding box

Comment 1 Fedora Update System 2020-01-11 01:25:14 UTC
texlive-base-20190410-7.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-acf8c538b5

Comment 2 Fedora Update System 2020-01-11 01:48:53 UTC
texlive-base-20180414-36.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e86cf4559b

Comment 3 Fedora Update System 2020-01-13 02:20:03 UTC
texlive-base-20190410-7.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2020-01-19 01:00:51 UTC
texlive-base-20180414-36.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.