MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Unable to open file (https://www.mobileread.com/forums/showthread.php?t=257331)

Toreth 03-15-2015 12:17 PM

Unable to open file
 
I've been editing a book and saving regularly when Windows decided to run an update. Of course the computer restarted and when I tried to open my book in Sigil, I got an error cannot load epub: C:\Users... When I showed the details I got the message cannot unzip epub: c:\users...

When I tried to open the book in Calibre's ebook viewer I get error: could not open ebook. not a zip file and the details showed:

calibre, version 2.20.0
ERROR: Could not open ebook: Not a ZIP file

Traceback (most recent call last):
File "site-packages\calibre\gui2\viewer\main.py", line 38, in run
File "threading.py", line 763, in run
File "site-packages\calibre\ebooks\oeb\iterator\book.py", line 99, in __enter__
File "site-packages\calibre\customize\conversion.py", line 241, in __call__
File "site-packages\calibre\ebooks\conversion\plugins\epub_in put.py", line 197, in convert
File "site-packages\calibre\utils\localunzip.py", line 223, in extractall
File "site-packages\calibre\utils\localunzip.py", line 210, in _extractall
ValueError: Not a ZIP file


The Nook app gave me the message: sorry unable to import.

I've even tried to restore my system but I still get the same messages. Is there any way to recover the file?

Thanks

theducks 03-15-2015 01:42 PM

Moderator Notice
Was posted in Sigil. Moved

eschwartz 03-15-2015 02:06 PM

This is an excellent example of why Windows Update was a bad move on Microsoft's part. But I guess you knew that already.

The PC must have restarted with excellent timing, while you were saving. :p

There are a variety of services out there that claim to (try to) repair corrupt zipfiles. Try renaming (a copy of) the epub to .zip and using some of them, it might work. ;)

Hopefully you had a backup of the ebook.

BetterRed 03-15-2015 02:44 PM

1 Attachment(s)
@Toreth - try using right click Restore Previous Versions on the file in question - maybe you'll get lucky.

And reconfigure Windows Update as shown, then you will be in control of when WU downloads, when WU installs, and when WU restarts.

Attachment 136025

The default setting assumes that entirety of the planet's population lives in the USA, that they can all afford to leave their computers running 24*7, and that they're all in bed at 03:00 in the morning :D

IMO auto-installs of anything are a menace - but most vendors, including MS, do NOT force you to accept being force fed. Although some of the majors in the Valley try mighty hard to do so.

BR

Moderator Notice
I also moved to Devices because its an OS issue - in truth its probably a Sigil issue, if the OP had been using the calibre editor then maybe the file would have been recoverable from a checkpoint - dunno if that's true as I never tried it

eschwartz 03-15-2015 03:55 PM

Hmm, interesting point -- checkpoints are saved within an editing session. Although not restored next time you edit, the info should still be accessible in the working directory, which is located in %TEMP% -- on Windows, this isn't (usually) cleared on reboot.

So if someone was using calibre's editor, the book could probably be restored, with work (mostly searching for the right folder), from the unpacked checkpoints directories.

Sigil doesn't use checkpoints, although it might have the same unpacked Tempfiles storage, I don't know -- I haven't used it in a while, and I never checked. Either way, the corruption might have affected those files as well -- but not calibre's checkpoints, which wouldn't be written to.

BetterRed 03-15-2015 06:33 PM

My appdata\local\temp is trashed on restart, but calibre has a private TEMP via CALIBRE_TEMP_DIR. Wherever possible I give all applications private TEMP areas. Avoids rummaging around in a pile of 'who knows what' when you're looking for something.

Does the editor take checkpoints of its own accord or only when user tells it to? There primary usage seems to be more like 'super undo' rather the checkpoint/restart facilities in TP monitors like CICS, Toledo, Sabre etc. That's where I first came across 'checkpoint' - a long, long time ago.

Ideally a substantial 'editor' (ie one in which you're likely to spend a long time) should do protection saves at a user specified interval, and be able to recover from it in the event of a crash, power out, equipment failure or other abrupt termination.

BTW - AFAIK WU does a bog-standard restart. If so then Sigil (or the calibre editor) would have got a message from Windows telling it to quit, at which point it could have done a 'protection save', and made a note of that in its control data. And then offered to reload that file next time it was used.

BR

eschwartz 03-15-2015 07:03 PM

Word processors and the like usually do Restores, neither Sigil nor calibre do. Perhaps implementing such features is non-trivial to the point only teams dare touch it -- calibre and Sigil both have tiny dev teams, Sigil particularly has tended to survive off of one-off contributions.

Calibre checkpoints require manual intervention.

BetterRed 03-15-2015 07:54 PM

1 Attachment(s)
Quote:

Originally Posted by eschwartz (Post 3064918)
Word processors and the like usually do Restores, neither Sigil nor calibre do. Perhaps implementing such features is non-trivial to the point only teams dare touch it -- calibre and Sigil both have tiny dev teams, Sigil particularly has tended to survive off of one-off contributions.

Calibre checkpoints require manual intervention.

Notepad++ does it. It's a Scite editor, so it may even be part of Scite furniture. I don't think Don Ho or Neil Hodgson ever had serried ranks of slave coders in their garages.

None of the schemes are perfect, not even Wordperfect's - but they do work most of the time. They've got me out of a few black holes in the event of power fails, video card crashes or my own stupidity.

BR

eschwartz 03-15-2015 08:06 PM

Hah -- never used Notepad++ all that much. Nice app, but no linux build.

But a text editor has far less to track than a document editor. Anyway -- it is still the kind of thing that someone needs to focus on, which is less likely when only one or two people work on said program, have many things to focus on, and no one ever complained loudly enough.

I am therefore not terribly surprised by any software that doesn't have this (excepting business-class and its competition, or software manned by said ranks :D). Would be a nice feature, of course.

Ripplinger 03-15-2015 08:20 PM

Quote:

Originally Posted by BetterRed (Post 3064897)
My appdata\local\temp is trashed on restart
...
BR

I never set mine to do that, I prefer to do it manually every so often. But maybe Toreth doesn't clean out his temp directory on reboots and the files will still be there (on Windows 7 typically under Users\YourUsername\AppData\Local\Temp\Sigil\). It's worth a look.

BetterRed 03-15-2015 08:43 PM

Quote:

Originally Posted by Ripplinger (Post 3064964)
I never set mine to do that, I prefer to do it manually every so often. But maybe Toreth doesn't clean out his temp directory on reboots and the files will still be there (on Windows 7 typically under Users\YourUsername\AppData\Local\Temp\Sigil\). It's worth a look.

:thumbsup: - definitely worth a look

Under normal circumstances it appears to have a copy of the book under edit as it was when opened, that gets deleted when Sigil closes. Question is, when Sigil gets a close message because Windows wants to do a restart does it leave it there. Maybe it does because if I kill Sigil the session folder is still there :)

eschwartz 03-15-2015 09:44 PM

And same with calibre -- it doesn't always get a chance to clean up properly. I noticed that a number of times with Windows, the temp folder would slowly fill with calibre data folders even when closing normally.
On linux it seems to be promptly deleted.

Maybe something to do with file locking.

kovidgoyal 03-16-2015 12:23 AM

A power outage or crash or forced reboot *cannot* corrupt a file being edited in the calibre editor. The calibre editor makes *atomic* updates to the file. That mean that it saves a copy of the edited file and then atomically renames it to the original, only if the save operation successfully completed. I have no idea about Sigil.

@BR: Having autosaves at an interval is a poor man's alternative to using atomic file operations for updating files. It is typically found in older editing software or editing software where the file format being edited is suitable for in-place updates.

eschwartz 03-16-2015 12:54 AM

Kovid -- how does atomic updating help one recover one's work if no save was attempted?

kovidgoyal 03-16-2015 01:04 AM

I was only addressing autosaves as a mechanism for protection against corruption caused by crashes, which is what appears to have happened to the OP.


All times are GMT -4. The time now is 09:23 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.