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
  pyside6 module not found ForeverNoob 4 1,268 Aug-18-2023, 04:36 PM
Last Post: snippsat
  Module Not Found Error bitoded 4 1,343 Jan-01-2023, 09:08 AM
Last Post: bitoded
  Module not found question sighhhh12 0 1,446 Sep-09-2022, 05:43 AM
Last Post: sighhhh12
  [SOLVED] Tkinter module not found Milan 7 21,401 Aug-05-2022, 09:45 PM
Last Post: woooee
  No module found when I run a main.py tomtom 2 1,410 Jul-20-2022, 09:24 AM
Last Post: tomtom
  "ModuleNotFoundError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package" chipx 3 7,234 Dec-09-2021, 07:05 AM
Last Post: chipx
Question Setuptools CLI program ModuleNotFoundError after splitting up module into package Postbote 1 2,279 Nov-25-2021, 06:35 PM
Last Post: Postbote
  No Module found in other directory than source code [SOLVED] AlphaInc 1 2,004 Nov-10-2021, 04:34 PM
Last Post: AlphaInc
  pdfminer to csv mfernandes 2 2,784 Jun-16-2021, 10:54 AM
Last Post: mfernandes
  KafkaUtils module not found on spark 3 pyspark aupres 2 7,255 Feb-17-2021, 09:40 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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