01-06-2018, 03:56 PM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Jan 2018
Device: none
|
Problems using Calibre 3.15.0 Database API
Hi,
sorry for the rookie question but I have trouble to get the Calibre database running. I'm trying my first steps to write an external (standalone) python program to extend the Calibre metadata of my Calibre library with some thousands of Amazon books. The environment is KUbuntu 16.04.3, Calibre 3.15.0. I followed the installation instructions from https://manual.calibre-ebook.com/develop.html and installed a binary Calibre 3.15.0 and the source code from git. Python is 2.7.12. I try to create a very simple program in the src folder ($CALIBRE_DEVELOP_FROM) and point it to my Calibre test library Code:
from calibre.library import db db = db('/home/myuserid/Calibre Library').new_api Code:
python calibreDbTest.py Hello, world! Traceback (most recent call last): File "calibreDbTest.py", line 1, in <module> from calibre.library import db File "/home/myuserid/Nextcloud/work/calibre/src/calibre/__init__.py", line 23, in <module> from calibre.startup import winutil, winutilerror File "/home/myuserid/Nextcloud/work/calibre/src/calibre/startup.py", line 85, in <module> import calibre.utils.resources as resources File "/home/myuserid/Nextcloud/work/calibre/src/calibre/utils/resources.py", line 67, in <module> _resolver = PathResolver() File "/home/myuserid/Nextcloud/work/calibre/src/calibre/utils/resources.py", line 18, in __init__ self.locations = [sys.resources_location] AttributeError: 'module' object has no attribute 'resources_location' /home/myuserid/Nextcloud/work/calibre/src/calibre/ptempfile.py:29: RuntimeWarning: Parent module 'calibre' not found while handling absolute import import shutil Thanks for hints and help Regards einnordlicht |
01-06-2018, 05:45 PM | #2 | |
Addict
Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
|
Quote:
Code:
path = os.environ.get('CALIBRE_PYTHON_PATH', '/usr/lib/calibre') if path not in sys.path: sys.path.insert(0, path) sys.resources_location = os.environ.get('CALIBRE_RESOURCES_PATH', '/usr/share/calibre') sys.extensions_location = os.environ.get('CALIBRE_EXTENSIONS_PATH', '/usr/lib/calibre/calibre/plugins') sys.executables_location = os.environ.get('CALIBRE_EXECUTABLES_PATH', '/usr/bin') |
|
Advert | |
|
01-06-2018, 09:28 PM | #3 |
creator of calibre
Posts: 43,912
Karma: 22669818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You run your python script with calibre-debug not with python.
https://manual.calibre-ebook.com/dev...on-environment |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aura H2O Database problems (recurring) | Oolong | Kobo Reader | 3 | 07-06-2017 04:15 PM |
Database problems | tdp1947 | Calibre | 15 | 06-19-2015 03:51 PM |
Calibre update breaks Calibre API | TechnoCat | Recipes | 5 | 01-28-2013 11:25 PM |
problems with calibre database | killa | Calibre | 1 | 06-09-2012 11:40 PM |
calibre's new plugin API | kovidgoyal | Plugins | 26 | 05-07-2011 02:43 PM |