Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-04-2017, 08:11 PM   #1
rfcdvc45
Junior Member
rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.
 
Posts: 4
Karma: 45500
Join Date: Dec 2017
Device: Kindle Voyage
CantOpenError

Used Calibre for several years without issue. Now multiple errors when trying to add books, or tick a custom Yes/No field, or download metadata, etc., etc.

Running WIN10 Pro installed on SSD C-drive. Calibre library located on local D-drive. The "metadata.db" and "metadata_db_prefs_backup.json" files are both living in the Calibre library folder. No syncing programs in use. Windows Defender is only antivirus running. Ample free space on all drives.

Typical Errors:
ERROR: Errors while adding
ERROR: Failed to set data
ERROR: Unhandled exception (IOError:[Errno 9] Bad file descriptor)

"Restore database" tool from the Calibre library toolbar icon fails. No doubt these issues all stem from the same anomaly, i.e., "CantOpenError. "

Desperate for solution. See error details below from trying to add a book:


----------------------------------------------------------------------
Failed to add the book: Microsoft Access 2010 VBA Macro Programming 2012
D:\Downloads\Microsoft Access 2010 VBA Macro Programming 2012\Microsoft Access 2010 VBA Macro Programming 2012.pdf
With error:
Traceback (most recent call last):
File "site-packages\calibre\gui2\add.py", line 399, in add_book
File "site-packages\calibre\db\legacy.py", line 224, in create_book_entry
File "site-packages\calibre\db\cache.py", line 63, in call_func_with_lock
File "site-packages\calibre\db\cache.py", line 1556, in create_book_entry
File "site-packages\calibre\db\backend.py", line 844, in execute
File "c:\t\t\apsw-j6gj96\apsw-3.13.0-r1\src\cursor.c", line 236, in resetcursor
CantOpenError: CantOpenError: unable to open database file
rfcdvc45 is offline   Reply With Quote
Old 12-04-2017, 10:30 PM   #2
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: 43,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Something, most likely an antivirus program is blocking calibre from opening the metadata.db file in its library folder.
kovidgoyal is offline   Reply With Quote
Old 12-04-2017, 10:54 PM   #3
rfcdvc45
Junior Member
rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.
 
Posts: 4
Karma: 45500
Join Date: Dec 2017
Device: Kindle Voyage
CantOpenError

Quote:
Originally Posted by kovidgoyal View Post
Something, most likely an antivirus program is blocking calibre from opening the metadata.db file in its library folder.
Thanks for responding, however that's not much help. As I said, the only antivirus I am running is Windows Defender which is pretty much baked into Windows 10. The only way to disable it is to install a third party antivirus. I can't think of any other thing that could be blocking the opening of the metadata.db file.
rfcdvc45 is offline   Reply With Quote
Old 12-05-2017, 12:17 AM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,532
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by rfcdvc45 View Post
Thanks for responding, however that's not much help. As I said, the only antivirus I am running is Windows Defender which is pretty much baked into Windows 10. The only way to disable it is to install a third party antivirus.
However, just to be sure, try excluding the calibre install directory in the Windows Defender Security Settings->Virus & threat protection settings panel - should only takes a moment to check.

Quote:
Originally Posted by rfcdvc45 View Post
I can't think of any other thing that could be blocking the opening of the metadata.db file.
For diagnostic purposes only, try
  • running calibre in Windows Safe Mode;
  • running calibre as Administrator;
  • using the CALIBRE_OVERRIDE_DATABASE_PATH Environment Variable to relocate the library database to somewhere like C:\calibre

BR
BetterRed is offline   Reply With Quote
Old 12-05-2017, 02:34 AM   #5
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Hm. I never seen Windows Defender blocking calibre (today and in the past). Maybe something else is going wrong.
Divingduck is offline   Reply With Quote
Old 12-05-2017, 02:55 AM   #6
rfcdvc45
Junior Member
rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.
 
Posts: 4
Karma: 45500
Join Date: Dec 2017
Device: Kindle Voyage
Quote:
Originally Posted by BetterRed View Post
However, just to be sure, try excluding the calibre install directory in the Windows Defender Security Settings->Virus & threat protection settings panel - should only takes a moment to check.


For diagnostic purposes only, try
  • running calibre in Windows Safe Mode;
  • running calibre as Administrator;
  • using the CALIBRE_OVERRIDE_DATABASE_PATH Environment Variable to relocate the library database to somewhere like C:\calibre

BR
BetterRed, Thanks again for the suggestions. However the plot thickens as I attempted to create the exception in Defender, per your advice. When I open the install directory, "C:\Program Files\Calibre2", I notice that the files and folders therein are all screwed up. A correct install dir would have four folders (DLLs, Microsoft.VC90.CRT, plugins2, qt_plugins, & resources). Instead I have one folder named "app". Inside the "app" folder are the DLLs, qt_plugins, & resources folders, plus the "pylib.zip" file. How does this happen? I've uninstalled/reinstalled several times and the contents of the Calibre2 folder still comes out this way. And each time I get an error, "Error 1900," I think, about failure to create link/or shortcut.

See attached screenshots of Calibre2 and app folders:

I'm convinced that Defender is not blocking the metadata.db file, and I doubt that the Safe Mode/CALIBRE_OVERRIDE_DATABASE_PATH solution would resolve anything, as I the library is not on a network drive.

There must be some way I can cleanly reinstall Calibre and get the correct Calibre2 folder structure and content. But every time I try, the install dir comes up this same way. Very frustrating! What am I doing wrong?
Attached Thumbnails
Click image for larger version

Name:	Calibre2 Folder.png
Views:	169
Size:	86.4 KB
ID:	160426   Click image for larger version

Name:	app folder.png
Views:	172
Size:	42.8 KB
ID:	160427  
rfcdvc45 is offline   Reply With Quote
Old 12-05-2017, 03:19 AM   #7
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Nothing wrong with this structure.
Here you will find some hints for a clean install:
https://manual.calibre-ebook.com/faq...is-not-working

I would suggest to run calibre first in debug mode. Maybe this will give you a bit more detail information.
Attached Thumbnails
Click image for larger version

Name:	calinstdir.JPG
Views:	211
Size:	141.2 KB
ID:	160430  
Divingduck is offline   Reply With Quote
Old 12-05-2017, 03:37 AM   #8
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: 43,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The folder layout is correct. It was changed in calibre 3.x

The cantopenerror literally means that sqlite issued an open() system call for the metadata.db file and it failed. That can happen only because:

1) The library path points to a non-existing directory/drive/etc.
2) Something is blocking access
3) permissions on the file/directory are screwed up

I suggest you start with a new library, run calibre from a command prompt as

calibre --with-library c:\library

making sure that the folder c:\library exists and is writable by your user account.

If that works you know it is something wrong with the old library folder, if it doesn't you know it is something blocking calibre.
kovidgoyal is offline   Reply With Quote
Old 12-05-2017, 04:00 AM   #9
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,532
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Divingduck View Post
Nothing wrong with this structure.
- why am I not surprised you use X2, I was about to post this

Click image for larger version

Name:	1.jpg
Views:	198
Size:	55.8 KB
ID:	160431

@rfcdvc45 - The install structure changed with version 3.0

I too doubt Defender is the culprit, but given its easy to exclude the calibre folder why not put that possibility to bed.

What it's more likely to be is a 3rd party program that runs at start up, or a Windows shell extension, running in Safe Mode will eliminate many of those.

And I've seen this a few times -- "blah blah' doesn't happen if I run calibre in admin mode -- I have no explanation for that, other than a Windows problem, IIRC in at least one instance it may have been solved with a system file scan.

And on a couple of occasions 'weird' problems have manifested in the 64 bit version but not in the 32 bit version, on the same machine - I have no explanation for that either. This is from the "calibre freezes/crashes" FAQ:

Quote:
On some 64 bit versions of Windows there are security software/settings that prevent 64-bit calibre from working properly. If you are using the 64-bit version of calibre try switching to the 32-bit version.
BR
BetterRed is offline   Reply With Quote
Old 12-05-2017, 04:30 AM   #10
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Quote:
Originally Posted by BetterRed View Post
- why am I not surprised you use X2, I was about to post this
BR
It look like but it's actually TotalComander. I use it since more than 20 years and it seems to be the only program since today that stay over decades of using windows systems
Divingduck is offline   Reply With Quote
Old 12-05-2017, 10:31 AM   #11
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: 29,754
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by rfcdvc45 View Post
Thanks for responding, however that's not much help. As I said, the only antivirus I am running is Windows Defender which is pretty much baked into Windows 10. The only way to disable it is to install a third party antivirus. I can't think of any other thing that could be blocking the opening of the metadata.db file.
Windows Defender plays nice with Calibre unless you have customized it in some unusual way.
I would look at some 'helper utilities' that you may have installed. Note: they don't need to be of the Malware kind, they just don't play nice.
theducks is offline   Reply With Quote
Old 12-05-2017, 04:20 PM   #12
rfcdvc45
Junior Member
rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.rfcdvc45 is that somebody.
 
Posts: 4
Karma: 45500
Join Date: Dec 2017
Device: Kindle Voyage
CantOpenError Solved!

Quote:
Originally Posted by theducks View Post
Windows Defender plays nice with Calibre unless you have customized it in some unusual way.
I would look at some 'helper utilities' that you may have installed. Note: they don't need to be of the Malware kind, they just don't play nice.
Thanks to all of you who helped me on this one. Yes, it was in fact something blocking the Calibre files, and yes, it was in fact Defender! Turns out it was a new feature in Defender that shipped with the latest Fall Creators Update v1709. The feature, which I had forgotten, and which I had enabled is called 'Controlled Folder Access.' It is supposed to help guard against potential ransomware attacks. Anyway, when I realized that this was the blocking agent, I created an exception for Calibre. Once unblocked, I created a new Calibre Library, copied back the book folders into it. And finally I had to use the 'Restore Database' tool in Calibre. Now all's well again.

You guys at MobileRead rock! Couldn't have done it without your help.
rfcdvc45 is offline   Reply With Quote
Old 12-05-2017, 05:53 PM   #13
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,532
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@rfcdvc45 - thanks for letting us know, karma coming your way

I have WU set to 60 days after the "suitable for business" version ships, so I'm still on 1703.

BR
BetterRed is offline   Reply With Quote
Old 12-06-2017, 03:12 AM   #14
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
@rfcdvc45 - never mind, I have this as well activated with exceptions for calibre and forgot it after I made the set up. Thanks for keep us informed.
Divingduck is offline   Reply With Quote
Reply

Tags
cantopenerror, corrupt database, failed to set data

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help!!!! CantOpenError: unable to open database file cbbs70a Library Management 2 06-11-2015 11:11 AM


All times are GMT -4. The time now is 12:11 AM.


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