Python Forum
pdfminer package: module isn't found
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pdfminer package: module isn't found
#1
Hello,
In many examples of using of pdfminer, there are imports like this:
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
I installed pdfminer (version 20191125according to pip list).
But there is no pdfinterp inside pdfminer.
Any comments ?
Thanks
Reply
#2
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.
Reply
#3
(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 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.
What is your pdfminer version ?

Output:
>>> from pdfminer.pdfinterp import PDFPageInterpreter Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from pdfminer.pdfinterp import PDFPageInterpreter ModuleNotFoundError: No module named 'pdfminer.pdfinterp' >>>
Reply
#4
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:
Output:
arcfour ascii85 ccitt cmapdb converter encodingdb fontmetrics glyphlist image latin_enc layout lzw pdfcolor pdfdevice pdfdocument pdffont pdfinterp pdfpage pdfparser pdftypes psparser rijndael runlength utils
Reply
#5
(Sep-13-2022, 05:53 PM)deanhystad Wrote: 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)

Output:
>>> import pkgutil, pdfminer >>> for a, modname, c in pkgutil.walk_packages(path=pdfminer.__path__): print(modname) rijndael >>>
Reply
#6
You are not importing pdfminer. What do you see when you run this?
import pdfminer

print(pdfminer.__file__)
Reply
#7
(Sep-13-2022, 06:45 PM)deanhystad Wrote: You are not importing pdfminer. What do you see when you run this?
import pdfminer

print(pdfminer.__file__)

Output:
>>> import pdfminer >>> print(pdfminer.__file__) Traceback (most recent call last): File "<pyshell#7>", line 1, in <module> print(pdfminer.__file__) AttributeError: module 'pdfminer' has no attribute '__file__' >>>
Reply
#8
How are you running this code? What Python are you using? Which OS? How do you run Python?
Reply
#9
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']
Reply
#10
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Upgraded Python: Module no longer found - for Linux Curbie 8 1,389 Mar-05-2025, 06:01 PM
Last Post: Curbie
  MPEG DASH Package implementation similar to M3U8 package anantha_narayanan 0 553 Feb-06-2025, 03:55 AM
Last Post: anantha_narayanan
Question [SOLVED] Upgraded Python: Module no longer found Winfried 1 1,024 Jan-01-2025, 02:43 PM
Last Post: Larz60+
  PDFminer outputs unreadable text during conversion from PDF to TXT Gromila131 6 1,527 Aug-06-2024, 08:20 AM
Last Post: Pedroski55
  Module not found error even though installed NZGeorge 1 4,584 Jul-10-2024, 09:08 AM
Last Post: Larz60+
  pyside6 module not found ForeverNoob 4 5,738 Aug-18-2023, 04:36 PM
Last Post: snippsat
  Module Not Found Error bitoded 4 2,562 Jan-01-2023, 09:08 AM
Last Post: bitoded
  Module not found question sighhhh12 0 2,148 Sep-09-2022, 05:43 AM
Last Post: sighhhh12
  [SOLVED] Tkinter module not found Milan 7 49,861 Aug-05-2022, 09:45 PM
Last Post: woooee
  No module found when I run a main.py tomtom 2 2,753 Jul-20-2022, 09:24 AM
Last Post: tomtom

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020