Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-27-2019, 03:45 PM   #1
bob.f
Connoisseur
bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!
 
Posts: 78
Karma: 99068
Join Date: Nov 2017
Device: N/A
"No module named calibrelibrary.database2" error

Would someone mind helping me troubleshoot the following error please?

Code:
C:\Program Files\Calibre2
>calibre-debug.exe -c "from calibrelibrary.database2 import LibraryDatabase2; db = LibraryDatabase2('c:\Users\Andrew\Calibre\ Library'); db.execute('select * from books b where b.id = 3094');"
Python function terminated unexpectedly
  No module named calibrelibrary.database2 (Error Code: 1)
Traceback (most recent call last):
  File "site.py", line 101, in main
  File "site.py", line 78, in run_entry_point
  File "site-packages\calibre\debug.py", line 276, in main
  File "<string>", line 1, in <module>
ImportError: No module named calibrelibrary.database2
bob.f is offline   Reply With Quote
Old 02-27-2019, 06:35 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,037
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Where did you get that commandline (those arguments)?
theducks is offline   Reply With Quote
Advert
Old 02-28-2019, 01:45 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,331
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That command line you are using is obsolete. If you want to list the books in the calibre database from the command line use the calibredb tool. https://manual.calibre-ebook.com/gen...calibredb.html
kovidgoyal is offline   Reply With Quote
Old 03-01-2019, 08:27 AM   #4
bob.f
Connoisseur
bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!
 
Posts: 78
Karma: 99068
Join Date: Nov 2017
Device: N/A
Quote:
Originally Posted by kovidgoyal View Post
That command line you are using is obsolete. If you want to list the books in the calibre database from the command line use the calibredb tool. https://manual.calibre-ebook.com/gen...calibredb.html
Thanks Kovid. I'm familiar with calibredb, but as far as I know it doesn't support issuing arbitrary queries against metadata.db, which is what I was trying to achieve here.

Instead, I am using sqlite to attach to and query the database directly.
bob.f is offline   Reply With Quote
Old 03-01-2019, 08:59 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,331
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibredb supports the full calibre search language, what are yo utrying to achieve?
kovidgoyal is offline   Reply With Quote
Advert
Old 03-09-2019, 11:43 AM   #6
bob.f
Connoisseur
bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!
 
Posts: 78
Karma: 99068
Join Date: Nov 2017
Device: N/A
Quote:
Originally Posted by kovidgoyal View Post
calibredb supports the full calibre search language, what are yo utrying to achieve?
I have a script that can be used to produce a selection of ten random books by creating a search filter of the form "id:x or id:y or id:z" etc.

In order to do this the script generates a count of all my unread books then generates 10 random numbers and executes a number of queries with the LIMIT 1 clause to select a random book (excluding certain criteria such as custom columns and tags).

I am aware of the read random book feature but I wanted something a little different.
bob.f is offline   Reply With Quote
Old 03-09-2019, 12:01 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,331
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can do all that with calibredb. Use calibredb search to get the ids of all unread books, with whatever other criteria you need. Have your script pick a random one from that list.

You can also do that in the calibre GUI. Create a Virtual library to show your unread books (virtual libraries are based on arbitrary search expressions). Then the pickk a random book feature will pick a book from that virtual library.
kovidgoyal is offline   Reply With Quote
Old 03-10-2019, 01:07 PM   #8
bob.f
Connoisseur
bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!bob.f has a thesaurus and is not afraid to use it!
 
Posts: 78
Karma: 99068
Join Date: Nov 2017
Device: N/A
Quote:
Originally Posted by kovidgoyal View Post
You can do all that with calibredb. Use calibredb search to get the ids of all unread books, with whatever other criteria you need. Have your script pick a random one from that list.

You can also do that in the calibre GUI. Create a Virtual library to show your unread books (virtual libraries are based on arbitrary search expressions). Then the pickk a random book feature will pick a book from that virtual library.
Nice, thanks Kovid. Keep up the good work
bob.f is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
python error: No module named MySQLdb stgabriel Development 1 03-10-2013 02:13 PM
"ImportError: No module named encutils" lesliek19 Conversion 7 10-02-2012 08:30 PM
Calibre 0.8.36 - Linux Compile Error - No module named dateutil.parser jasn Calibre 2 01-21-2012 11:36 PM
Error on install: No module named PyQt4 good_man Calibre 4 02-18-2011 03:10 PM
ebook-meta error - "No module named podofo" jimrothstein Calibre 1 01-15-2011 09:58 AM


All times are GMT -4. The time now is 06:48 AM.


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