jsvine / pdfplumber

Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables.
MIT License
6.57k stars 659 forks source link

Error importing in ubuntu #362

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello! When i´m trying importing in ubuntu, this error is displayed:

>>> import pdfplumber
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pdfplumber/__init__.py", line 10, in <module>
    from .pdf import PDF
  File "/usr/local/lib/python3.5/dist-packages/pdfplumber/pdf.py", line 49
    f'[WARNING] Metadata key "{k}" could not be parsed due to '
                                                              ^
SyntaxError: invalid syntax
jsvine commented 3 years ago

My best guess is that your environment (or virtual environment) is using Python 2, rather than Python 3.

samkit-jain commented 3 years ago

File "/usr/local/lib/python3.5/dist-packages/pdfplumber/pdf.py", line 49

@betances It seems like you are using Python 3.5. The support for Python 3.5 was dropped in version 0.5.23. Request you to upgrade to Python 3.6 or higher if you want to use pdfplumber 0.5.23 or higher else downgrade to pdfplumber 0.5.22 or lower.

jsvine commented 3 years ago

Ah, good catch, @samkit-jain, and thanks for reading the traceback more carefully than I did! I concur.

ghost commented 3 years ago

File "/usr/local/lib/python3.5/dist-packages/pdfplumber/pdf.py", line 49

@betances It seems like you are using Python 3.5. The support for Python 3.5 was dropped in version 0.5.23. Request you to upgrade to Python 3.6 or higher if you want to use pdfplumber 0.5.23 or higher else downgrade to pdfplumber 0.5.22 or lower.

Thanks! :)