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

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

Closed amanrajpoot101 closed 1 year ago

amanrajpoot101 commented 1 year ago

Describe the bug

in the beginning, when I have to use the pdf plumber is worked very fine but 2 days later is not working like pdfplumber.open("mypdf.pdf") and extract_text() function. I have to uninstall the library and re-install it but nothing has changed..please I have checked youtube and the article but didn't get any solution, please support me.

A clear and concise description of what the bug is. pdfplumber is not working..please help me to resolve it or highlight the mistake if i did.

Code to reproduce the problem

pdf = pdfplumber.open("INV592.pdf") ^^^^^^^^^^^^^^^ AttributeError: partially initialized module 'pdfplumber' has no attribute 'open' (most likely due to a circular import)

Paste it here, or attach a Python file.

import pyPDF2

import pdfplumber

def meta_data(): pdf = pdfplumber.open("INV592.pdf") print(format(len(pdf.pages))) meta_data()

PDF file

INV592.pdf

Please attach any PDFs necessary to reproduce the problem.

If you need to redact text in a sensitive PDF, you can run it through JoshData/pdf-redactor.

Expected behavior

What did you expect the result should have been?

Actual behavior

What actually happened, instead?

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

Additional context

Add any other context/notes about the problem here.

jsvine commented 1 year ago

Hi @amanrajpoot101, judging from the error, I'm guessing that you have both pdfminer and pdfminer.six installed. Try this in whatever environment you're using:

pip uninstall pdfminer
pip uninstall pdfminer.six
pip uninstall pdfplumber
pip install -U pdfplumber

Closing as this is unlikely to be a pdfplumber bug, but feel free to continue the conversation here.