pdfminer package: module isn't found - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: pdfminer package: module isn't found (/thread-38189.html) |
pdfminer package: module isn't found - Pavel_47 - Sep-13-2022 Hello, In many examples of using of pdfminer, there are imports like this: from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreterI installed pdfminer (version 20191125according to pip list). But there is no pdfinterp inside pdfminer. Any comments ? Thanks RE: pdfminer package: module isn't found - deanhystad - Sep-13-2022 When I run the posted code I don't get any error messages. I also looked at the project page and saw there is a pdfinterp submodule. What is the error message? Do you get an import error if you "import pdfminer"? I have installed packages in the wrong Python in the past. Easy to do when you have multiple virtual environments. RE: pdfminer package: module isn't found - Pavel_47 - Sep-13-2022 (Sep-13-2022, 03:08 PM)deanhystad Wrote: When I run the posted code I don't get any error messages. I also looked at the project page and saw there is a pdfinterp submodule.What is your pdfminer version ?
RE: pdfminer package: module isn't found - deanhystad - Sep-13-2022 I am using pdfminer 20191125 with Python 3.9.0. What does this print? import pkgutil, pdfminer for a, modname, c in pkgutil.walk_packages(path=pdfminer.__path__): print(modname)I get this:
RE: pdfminer package: module isn't found - Pavel_47 - Sep-13-2022 (Sep-13-2022, 05:53 PM)deanhystad Wrote: I am using pdfminer 20191125 with Python 3.9.0.
RE: pdfminer package: module isn't found - deanhystad - Sep-13-2022 You are not importing pdfminer. What do you see when you run this? import pdfminer print(pdfminer.__file__) RE: pdfminer package: module isn't found - Pavel_47 - Sep-13-2022 (Sep-13-2022, 06:45 PM)deanhystad Wrote: You are not importing pdfminer. What do you see when you run this?
RE: pdfminer package: module isn't found - deanhystad - Sep-13-2022 How are you running this code? What Python are you using? Which OS? How do you run Python? RE: pdfminer package: module isn't found - snippsat - Sep-13-2022 Look if have named a file pdfminer.py or folder,is a common mistake in these cases.Do this. >>> import pdfminer >>> >>> dir(pdfminer) ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__']So these are the specials methods in pdfminer. If you see something else or nothing then you import a file/folder that is not pdfminer. pdfinterp import the ordinary methods it has.>> import pdfminer.pdfinterp >>> >>> dir(pdfminer) ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'arcfour', 'ascii85', 'ccitt', 'cmapdb', 'encodingdb', 'fontmetrics', 'glyphlist', 'latin_enc', 'lzw', 'pdfcolor', 'pdfdevice', 'pdfdocument', 'pdffont', 'pdfinterp', 'pdfpage', 'pdfparser', 'pdftypes', 'psparser', 'runlength', 'settings', 'utils'] RE: pdfminer package: module isn't found - deanhystad - Sep-13-2022 A pdfminer.py somewhere in the path was what I was thinking, but what kind of file doesn't raise an import error and doesn't have a __file__ attribute? I cannot make that happen if I try. |