![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
|
How is this possible?
I wrote a script to sync metadata from Calibre to KyBook3, which works well. I decided it should really be a plugin and downloaded the interface plugin demo and got it working as a plugin. Went to open Calibre the next day and the plugin refused to load (although calibre-debug -g says it has).
Thinking I must have changed something, I commented out code until I got it working again and started putting the code back in bit by bit. But it kept loading and working until all the code was back in. (The md5s of the file were the same.) Does anyone know what could cause this? |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Ya need to post the debug log (please wrap in spoiler),
And maybe attach your zipped script so the gurus can see what you did ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
|
Log file
The plugin was working last night on my MacBook. I went to produce the log file this morning and did this:
> calibre-customize -b . > Plugin updated: KyBook3 Sync (1, 0, 1) Started Calibre and Restart in Debug Mode from the toolbar and got this: Spoiler:
So it seems it is intermittently failing to find urllib3. (Or, possibly, other modules when it fails.) As I said, if I comment out the code and put it back in again the problem goes away and randomly comes back again. Is it a memory issue? As I'm loading quite a lot of Python code to get the Requests module. Last edited by karl1c; 03-26-2019 at 06:57 PM. |
![]() |
![]() |
![]() |
#4 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
|
BTW, urllib3 is being loaded by the Requests module rather than 'directly' from the plugin scripts.
|
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You cannot depend on random python libraries unless yo bundle them with your plugin. requests is not part of calibre's python environment. Use mechanize or the stdlib urllib modules instead.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
|
@kovidgoyal It is bundled in the plugin. That's why it does work intermittently. :-(
|
![]() |
![]() |
![]() |
#7 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
|
It seems the problem was that Calibre would randomly refuse to load the python modules included in the plugin zip file. I resolved the problem by removing the need for the modules.
|
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
I did have a look at this last night, but ran out of time.
The problem I saw was that the import were not finding the modules. The times I have done something like this, I needed to prefix the included module name with the plugins details. An example I have is: Code:
import calibre_plugins.goodreads_sync.httplib2 as httplib2 I made this change for a few of the statements, but, didn't have time to do all. Unfortunately, that would mean going through all those modules and changing the import statements. There might be a better way with a load library statement or using relative paths, but, I haven't experimented. |
![]() |
![]() |