08-17-2018, 12:26 AM | #1 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
Using wordpress_xmlrpc package in my plugin
I'm writing a plug-in to export book files directly from calibre into a Wordpress site and would like to use the python-zwordpress-xmlrpc package to do it, as it makes wordpress access very easy. (https://python-wordpress-xmlrpc.read....io/en/latest/)
This may be a newbie problem but I'm stuck on how to access the package's functions. I've placed the files in my plug-in folder. They're in a directory called wordpress_xmlrpc which is sitting inside the plugin folder (I'm currently just trying to test them with the interface_demo plugin). In my plug-in code I'm using the following include statements: from calibre_plugins.interface_demo.wordpress_xmlrpc.ba se import * from calibre_plugins.interface_demo.wordpress_xmlrpc.wo rdpress import * But it's not finding the stuff. Help! Thanks |
08-17-2018, 01:12 AM | #2 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Firstly, it is always a good idea to include the actual error messages produced. That will help to tell us where the error is. For example, I don't know if the import if failing, or if it is when you actually call a method from the packages.
Assuming it is the import failing, have these files been included in the zip file for the plugin? From what you have said, I'm not sure whether you have them in the package, or simply put them in the plugin directory of the calibre preferences. |
Advert | |
|
08-17-2018, 01:15 AM | #3 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
When it launches, it logs the error:
ImportError: No module named wordpress_xmlrpc.base And yes, I have them in the zip file along with the rest of the plug-in. Thanks! |
08-17-2018, 05:11 AM | #4 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
That looks like the import then. And it should mean it cannot find the files.
The times I've seen this with a plugin it has either been a spelling mistake in a file somewhere, or the file didn't actually get included in the zip file. Does wordpress_xmlrpc have any dependencies? The only other thing I can think of is that whenever I have done this, I either use the import form of this, or explicitly name what I want from the module. So, it would be: Code:
import calibre_plugins.interface_demo.wordpress_xmlrpc.base from calibre_plugins.interface_demo.wordpress_xmlrpc.wordpress import something_or_other Code:
import calibre_plugins.interface_demo.wordpress_xmlrpc If you want to attach the plugin, or put it somewhere and PM the link, I can try it over the weekend and hopefully see what is wrong. |
08-17-2018, 08:17 PM | #5 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
Oh well-done! It took a while to find them all, but once I set all the include paths to be very explicit, it loaded just fine. Thank you so much for your help!
|
Advert | |
|
Tags |
modules, packages, plug-ins, wordpress |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. | slowsmile | Plugins | 3 | 07-25-2018 09:14 PM |
Goodread Perception Expander plugin not shown on plugin list (kobo h2o) | www | KOReader | 4 | 09-28-2017 11:34 AM |
Problem with my ScrambleEbook plugin and the Plugin Updater tool | jackie_w | Development | 14 | 01-19-2017 11:49 PM |
Multi-plugin package | jgoguen | Development | 5 | 05-25-2015 05:21 PM |
Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 03:24 AM |