View Single Post
Old 10-23-2022, 03:29 AM   #1
SylvanKnight
Member
SylvanKnight began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Sep 2022
Device: kindle
How to include a Python module with the plugin

Back with another question for something I can't quite figure out.

I have the functionality I want (for the most part), but my plugin uses PyPDF2 to go through PDF text. When I tried to import the plugin to test it, I got the following error:

calibre, version 6.0.0
ERROR: Unhandled exception: <b>ModuleNotFoundError</b>:No module named 'PyPDF2'

Code:
calibre 6.0  embedded-python: True
Windows-10-10.0.19043 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19043')
Python 3.10.1
Windows: ('10', '10.0.19043', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Edit Book plugin demo (1, 0, 0) && FanFicFare (4, 16, 0) && Goodreads (1, 7, 1) && Kindle hi-res covers (0, 5, 0)
Traceback (most recent call last):
  File "calibre\gui2\preferences\plugins.py", line 325, in add_plugin
  File "calibre\customize\ui.py", line 476, in add_plugin
  File "calibre\customize\ui.py", line 64, in load_plugin
  File "calibre\customize\zipplugin.py", line 304, in load
  File "importlib\__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "calibre\customize\zipplugin.py", line 203, in exec_module
  File "calibre_plugins.dummy2.__init__", line 9, in <module>
ModuleNotFoundError: No module named 'PyPDF2'

I'm assuming that's because PyPDF2 isn't in Calibre. My question is now

1) What PDF tools are in Calibre so that I can use those instead of PyPDF2, or
2) How do I include PyPDF2 with my plugin?

Thanks in advance
SylvanKnight is offline   Reply With Quote