Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 02-15-2020, 01:14 PM   #1
Fischchen
Junior Member
Fischchen began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2020
Device: Raspberry pi 3
Question Use third-party Libary

Hey guys,
i've been trying to make a simple plugin for calibre which uses the GPIO pins of my Raspberry. I wrote a simple plugin but when it try to import it I get the error message
Code:
Python function terminated unexpectedly
  No module named gpiozero (Error Code: 1)
 Traceback (most recent call last):
  File "site.py", line 114, in main
  File "site.py", line 88, in run_entry_point
  File "site-packages\calibre\customize\ui.py", line 792, in main
  File "site-packages\calibre\customize\ui.py", line 752, in build_plugin
  File "site-packages\calibre\customize\ui.py", line 472, in add_plugin
  File "site-packages\calibre\customize\ui.py", line 61, in load_plugin
  File "site-packages\calibre\customize\zipplugin.py", line 203, in load
  File "importlib\__init__.py", line 37, in import_module
  File "site-packages\calibre\customize\zipplugin.py", line 185, in load_module
  File "calibre_plugins.dummy1.__init__", line 2, in <module>
ImportError: No module named gpioze
Can somebody please help me?!?!? I have to be done with this until next week, so please somebody help me!

Thanks in advance
Fischchen

ps:sorry for my english im german
Fischchen is offline   Reply With Quote
Old 02-15-2020, 04:09 PM   #2
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Calibre knows nothing about anything outside of its ecosystem, so you must make external-to-Calibre files visible to your plugin yourself.

For tiny packages (e.g. a useful python module that you need and perhaps found on Github), you could simply hard-copy it into your plugin's folder to make it a private copy.

Example: from .fuzzywuzzy import fuzz, string_processing, utils

For non-trivial packages, you might try (never needed it myself, so no guarantees) something like this:

import sys
sys.path.append('/path_to/folderhavingyourfile')
import yourfile

Personally, I would defer any imports until the user invokes an action in ui.py to avoid premature allocation and use of memory. In other words, do not import it at the top of ui.py. Make the user click a pushbutton or cause some other event that requires that the file be imported for the first time before continuing.



DaltonST
DaltonST is offline   Reply With Quote
Advert
Reply

Tags
error, gpiozero, plugin, raspberry pi


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kobo Glo and no libary schaf Kobo Reader 2 01-16-2014 12:23 AM
Mysterious books appear in my libary?! xendula Amazon Kindle 4 10-04-2012 01:37 AM
Do you know how to return ebooks to the libary? BWinmill General Discussions 45 07-14-2012 06:41 PM
Limiting libary display nikev Library Management 1 03-20-2011 03:57 PM
Liverpool overdrive libary becket General Discussions 8 05-11-2010 12:12 PM


All times are GMT -4. The time now is 01:30 PM.


MobileRead.com is a privately owned, operated and funded community.