jsvine / pdfplumber

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

AttributeError: partially initialized module 'pdfplumber' has no attribute 'open' (most likely due to a circular import) #699

Closed lili1234567890 closed 2 years ago

lili1234567890 commented 2 years ago

with pdfplumber.open("G:/word/0052b7958e89.pdf") as pdf: AttributeError: partially initialized module 'pdfplumber' has no attribute 'open' (most likely due to a circular import)

![Uploading image.png…]()

jsvine commented 2 years ago

Hi @lili1234567890, and thanks for the report. It's a strange one, and I can't immediately think of a clear reason why it would happen. Two follow-up questions:

lili1234567890 commented 2 years ago
  • Try reinstalling the library by running pip uninstall pdfplumber and the pip install pdfplumber. Do you still have the problem? yes! I still have have problem , I have uninstalled it three times
  • If you downgrade to an earlier version via pip install pdfplumber==0.7.0, do you still have the problem? --- Successfully installed pdfplumber-0.7.0 but I still have have problem?

This is my code:

import pdfplumber import pandas as pd

with pdfplumber.open("G:/word/0052b7958e89.pdf") as pdf: page = pdf.pages[0] # 第一页的信息 text = page.extract_text() print(text)

When I run it, I have the following problem Traceback (most recent call last): File "G:/word/pdfplumber.py", line 1, in import pdfplumber File "G:\word\pdfplumber.py", line 4, in with pdfplumber.open("G:/word/0052b7958e89.pdf") as pdf: AttributeError: partially initialized module 'pdfplumber' has no attribute 'open' (most likely due to a circular import)

jsvine commented 2 years ago

Ah, perhaps this provides a clue: https://stackoverflow.com/a/60677039

Do you happen to have a added a file called pdfplumber.py in your working directory?

lili1234567890 commented 2 years ago

Ah, perhaps this provides a clue: https://stackoverflow.com/a/60677039

Do you happen to have a added a file called pdfplumber.py in your working directory? Thank you. I solved the problem

salmanznetwork commented 6 months ago

Ah, perhaps this provides a clue: https://stackoverflow.com/a/60677039 Do you happen to have a added a file called pdfplumber.py in your working directory? Thank you. I solved the problem

lili1234567890 commented 6 months ago

这是来自QQ邮箱的假期自动回复邮件。您好,邮件我已收到,祝好!