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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-10-2010, 07:44 PM   #1
Nomadin
Member
Nomadin began at the beginning.
 
Nomadin's Avatar
 
Posts: 10
Karma: 10
Join Date: Nov 2007
Device: EZReader Pro
Error importing mobi files [solved]

I am receiving the following error when I attempt to add mobi files to Calibre. This is just one example, it happens on every one.
WARNING: Failed to read metadata: Failed to read metadata from the following:

The_Buried_Pyramid.mobi
Traceback (most recent call last):
File "site-packages\calibre\ebooks\metadata\worker.py", line 54, in read_metadata_
File "shutil.py", line 52, in copyfile
IOError: [Errno 13] Permission denied: 'C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\calibre - E-book Management'
Any ideas where I should look first? The file is added to Calibre, but I have to add all of the metadata manually.



(Windows 7, Calibre 0.6.39)

Last edited by Nomadin; 02-10-2010 at 08:33 PM.
Nomadin is offline   Reply With Quote
Old 02-10-2010, 08:17 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: 25,622
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Do you have a plugin for removing drm from mobi files?
kovidgoyal is offline   Reply With Quote
 
Enthusiast
Old 02-10-2010, 08:24 PM   #3
kilikini
Enthusiast
kilikini has a complete set of Star Wars action figures.kilikini has a complete set of Star Wars action figures.kilikini has a complete set of Star Wars action figures.kilikini has a complete set of Star Wars action figures.
 
kilikini's Avatar
 
Posts: 43
Karma: 376
Join Date: Jan 2009
Location: California, USA
Device: K3, KFire, iPad, iPhone
I was also receiving this error while adding prc/mobi files and using the mobidedrm plugin, but after updating the plugin to the latest version of mobidedrm, 0.10, the error no longer occurs and calibre is again able to read the metadata successfully.
kilikini is offline   Reply With Quote
Old 02-10-2010, 08:25 PM   #4
Nomadin
Member
Nomadin began at the beginning.
 
Nomadin's Avatar
 
Posts: 10
Karma: 10
Join Date: Nov 2007
Device: EZReader Pro
Yes, I de-protected my Kindle books for future protection. I guess that script is interfering?
Nomadin is offline   Reply With Quote
Old 02-10-2010, 08:32 PM   #5
Nomadin
Member
Nomadin began at the beginning.
 
Nomadin's Avatar
 
Posts: 10
Karma: 10
Join Date: Nov 2007
Device: EZReader Pro
Quote:
Originally Posted by kilikini View Post
I was also receiving this error while adding prc/mobi files and using the mobidedrm plugin, but after updating the plugin to the latest version of mobidedrm, 0.10, the error no longer occurs and calibre is again able to read the metadata successfully.
Thanks for the lead! For the moment, I disabled the plugin and the import worked perfectly.

Thank you both for the incredibly quick reply!
Nomadin is offline   Reply With Quote
Old 02-16-2010, 05:11 AM   #6
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by Nomadin View Post
Thanks for the lead! For the moment, I disabled the plugin and the import worked perfectly.
I have seen a few reports of this problem, but I don't know what could be causing it.

I attach a dummy import plug-in. It does nothing except make a temporary copy of the file and returns that to Calibre. (In a very similar manner to MobiDeDRM, but without doing any manipulation of the file.)

Perhaps people who've had problems with the MobiDeDRM plug-in could try this plug-in (removing any other mobi/prc/azw plugin first) and see if they still have a problem with import. If they do, perhaps Kovid could take a look and suggest what the problem is with this (completely innocuous) code.
Attached Files
File Type: zip Dummy_plugin.py.zip (1.3 KB, 69 views)
pdurrant is offline   Reply With Quote
Old 02-16-2010, 05:23 AM   #7
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 63,129
Karma: 41205449
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Onyx T68, N7,
It looks as if it's attempting to create a file in a directory in which it doesn't have write access.
HarryT is offline   Reply With Quote
Old 02-16-2010, 05:40 AM   #8
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by HarryT View Post
It looks as if it's attempting to create a file in a directory in which it doesn't have write access.
If you look at the dummy plug-in, you'll see that it just copies the input file to an output file using the Calibre-provided temporary_file method.

http://calibre-ebook.com/user_manual...filetypeplugin

Now, it might be that the code isn't implementing a FileTypePlugin correctly. Or perhaps there's a problem with Calibre. that's why I created this dummy plug-in. Now I need

(1) someone who's had a problem with Mobipocket import plug-ins to try this dummy plug-in and see if there's still a problem
(2) If there is still a problem, for someone who knows more about Calibre plug-ins that me to take a look at the plug-in and see if there's something wrong with it
(3) If there isn't, for someone to try to work out what's wrong with the Calibre/Plug-in interaction.
pdurrant is offline   Reply With Quote
Old 02-16-2010, 06:07 AM   #9
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by pdurrant View Post
Calibre-provided temporary_file method.
Hmm.. I've been looking at this bit of code and the documentation, and I can see a potential problem or two.

Here's the guts of the plugin:

Code:
def run(self, path_to_ebook):
    of = self.temporary_file('.mobi')
    data_file = file(path_to_ebook, 'rb').read()
    file(of.name, 'wb').write(data_file)
    return of.name
Now the documentation describes temporary_file as returning a file-like object. It doesn't say whether this file object is open, and if it is, whether it's open in binary of text mode.

So the plug-in uses the file path from the open to make a new file object, open it for binary writing, and writes the input file to the temporary file.

* Should the plug-in be using the of.name in this way, and opening the file as binary write itself?
* Should the plug-in be closing the temporary_file in seom explicit way?

Last edited by pdurrant; 02-16-2010 at 06:09 AM. Reason: added code tags
pdurrant is offline   Reply With Quote
Old 02-16-2010, 01:27 PM   #10
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: 25,622
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Temporary files are always opened in w+b (write, random access, binary)

Code:
of = self.temporary_file('.mobi')
of.write(data)
of.close()
return of.name
kovidgoyal is offline   Reply With Quote
Old 02-16-2010, 02:44 PM   #11
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by kovidgoyal View Post
Temporary files are always opened in w+b (write, random access, binary)
Ah - thank you. I'll get someone to give it a go.
pdurrant is offline   Reply With Quote
Old 02-17-2010, 06:19 AM   #12
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by kovidgoyal View Post
Temporary files are always opened in w+b (write, random access, binary)
That seems to have done the trick. Thanks again.

A couple more questions:

Suppose a Filetype plugin was unable to successfully import a file for some reason.

1. What would be the best way to report this error to the user?
2. How would is be best to tell Calibre that the import had failed?
pdurrant is offline   Reply With Quote
Old 02-17-2010, 08:04 AM   #13
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,497
Karma: 424627
Join Date: Mar 2009
Device: iPad
Here's a template that lets you display a simple dialog:

Code:
import os
from calibre.customize import FileTypePlugin

class HelloWorld(FileTypePlugin):

    name                = 'HelloWorld'
    description         = 'A shell for creating plugins'
    supported_platforms = ['windows', 'osx', 'linux']
    author              = 'your_name_here'
    version             = (1, 0, 0)
    file_types          = set(['your_file_type_here'])
    on_import           = True 

    def run(self, path_to_ebook):
        from calibre.gui2 import is_ok_to_use_qt
        from PyQt4.Qt import QMessageBox

        if is_ok_to_use_qt():
            QMessageBox.question( None, 
                        'Hello World Plugin', 
                        "path_to_ebook: %s" % path_to_ebook,
                         QMessageBox.Ok)

        return path_to_ebook
I believe if you return None calibre understands that the import failed.

G
GRiker is offline   Reply With Quote
Old 02-17-2010, 12:23 PM   #14
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by GRiker View Post
Here's a template that lets you display a simple dialog:

I believe if you return None calibre understands that the import failed.
Thank you. That looks simple enough.
pdurrant is offline   Reply With Quote
Old 02-17-2010, 01:09 PM   #15
pdurrant
The Grand Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 31,178
Karma: 86241230
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by pdurrant View Post
Thank you. That looks simple enough.
I have a message box appearing now - thank you.

But returning None doesn't stop Calibre trying to import the file. Perhaps when a script can't do the intended conversion, it would be best just to return the original file path.
pdurrant is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues importing mobi books from Fictionwise. splat Calibre 14 02-22-2010 02:35 AM
Error importing epub book to calibre and ipod touch BigHoss Calibre 0 01-24-2010 10:21 AM
unencrypted azw books - error importing abrinton Calibre 4 01-19-2010 02:57 PM
Error when importing MobiPocket files. mbovenka Calibre 7 08-16-2008 10:07 AM
Importing multiple files into Mobi Reader Calamity Bookeen 0 07-25-2008 10:57 AM


All times are GMT -4. The time now is 12:18 PM.


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