pip3 install PyMuPDF
Collecting PyMuPDF Using cached PyMuPDF-1.18.17-cp37-cp37m-win_amd64.whl (5.4 MB)
Installing collected packages: PyMuPDF
Successfully installed PyMuPDF-1.18.17
import fitz
doc = fitz.open("my_pdf.pdf")
When I look for def open
on the fitz.py
file, I find nothing.
So I understand the error But I don't understand why the file that I download doesn't have this function ? Can someone share the good files please ? Or maybe I missed something else ?
FULL TRACE:
runfile('D:/Documents/Python_projects/Point_and_area_pdf_to_excel/get_info.py', wdir='D:/Documents/Python_projects/Point_and_area_pdf_to_excel')
Reloaded modules: six, dateutil._common, dateutil.relativedelta, dateutil.tz._common, dateutil.tz._factories, dateutil.tz.win, dateutil.tz.tz, dateutil.tz, dateutil.parser._parser, dateutil.parser.isoparser, dateutil.parser, chardet.enums, chardet.charsetprober, chardet.charsetgroupprober, chardet.codingstatemachine, chardet.escsm, chardet.escprober, chardet.latin1prober, chardet.mbcssm, chardet.utf8prober, chardet.mbcharsetprober, chardet.euctwfreq, chardet.euckrfreq, chardet.gb2312freq, chardet.big5freq, chardet.jisfreq, chardet.chardistribution, chardet.jpcntx, chardet.sjisprober, chardet.eucjpprober, chardet.gb2312prober, chardet.euckrprober, chardet.cp949prober, chardet.big5prober, chardet.euctwprober, chardet.mbcsgroupprober, chardet.hebrewprober, chardet.sbcharsetprober, chardet.langbulgarianmodel, chardet.langgreekmodel, chardet.langhebrewmodel, chardet.langrussianmodel, chardet.langthaimodel, chardet.langturkishmodel, chardet.sbcsgroupprober, chardet.universaldetector, chardet.version, chardet
Traceback (most recent call last):
File "D:\Documents\Python_projects\Point_and_area_pdf_to_excel\get_info.py", line 45, in <module>
print(get_dict_list(path))
File "D:\Documents\Python_projects\Point_and_area_pdf_to_excel\get_info.py", line 7, in get_dict_list
text_list = get_pdf_page_text_list(pdf_path)
File "D:\Documents\Python_projects\Point_and_area_pdf_to_excel\get_info.py", line 19, in get_pdf_page_text_list
doc = fitz.open(pdf_path)
AttributeError: module 'fitz' has no attribute 'open'
This is likely to be an installation issue and looks like there already exists a package fitz
installed on your environment and is unrelated to PyMuPDF
.
So when PyMuPDF
calls fitz
it might actually be calling the wrong fitz
package.
You can consider doing a clean install of all dependencies or create a virtual environment to work with PyMuPDF
.
You can also try rolling back fitz
to version 1.16.14