sfneal / PyPDF3

A utility to read and write PDFs with Python
https://pythonhosted.org/PyPDF2/
Other
72 stars 15 forks source link

SyntaxError: invalid syntax #10

Open clach04 opened 3 years ago

clach04 commented 3 years ago

setup.py documents python 2 and 3 support:

Change https://github.com/sfneal/PyPDF3/commit/8691814abf77a035524805d764c6e1220dc1d607 introduces F strings which are a python 3.6+ specific feature

This breaks support for older python versions, including 3.5.3 (which is the current latest version available for Raspberry Pi's Raspbian).

Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyPDF3 import PdfFileReader
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/py/ebook_rename/py35env/lib/python3.5/site-packages/PyPDF3/__init__.py", line 1, in <module>
    from .pdf import PdfFileReader, PdfFileWriter
  File "/root/py/ebook_rename/py35env/lib/python3.5/site-packages/PyPDF3/pdf.py", line 66, in <module>
    from .generic import *
  File "/root/py/ebook_rename/py35env/lib/python3.5/site-packages/PyPDF3/generic.py", line 494
    return NameObject(f"{ss[0]}+{''.join([f'#{c:X}' for c in ss[1].encode()])}")
                                                                              ^
SyntaxError: invalid syntax

Is this a bug or expected? Readme/setup.py would benefit from a update if the later.

clach04 commented 3 years ago

Meant to tag @TakamiChie in original report.

captn3m0 commented 2 years ago

+1, it would be better setup.py was updated to reflect a Python 3.x requirement.