ralsina / aranduka

Automatically exported from code.google.com/p/aranduka
0 stars 1 forks source link

Display error message when failing to read epub file #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add an invalid epub file to your Aranduka
2. Attempt to open it

What is the expected output? What do you see instead?
The program should display an error message saying that the file has an 
incorrect format. Instead it doesn't do anything.

Please use labels and text to provide additional information.

Traceback information:

Traceback (most recent call last):
  File "main.py", line 177, in <lambda>
    lambda f = f: self.openEpub(f.file_name))
  File "main.py", line 155, in openEpub
    viewer = EpubViewer(fname)
  File "/home/elbarto/aranduka/src/epubviewer.py", line 11, in __init__
    self.epub = EpubDocument(fname)
  File "/home/elbarto/aranduka/src/epubparser.py", line 17, in __init__
    self.book = zipfile.ZipFile(fname, "r")
  File "/usr/lib/python2.6/zipfile.py", line 696, in __init__
    self._GetContents()
  File "/usr/lib/python2.6/zipfile.py", line 716, in _GetContents
    self._RealGetContents()
  File "/usr/lib/python2.6/zipfile.py", line 728, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

Original issue reported on code.google.com by andresgattinoni on 25 Jan 2011 at 2:40

GoogleCodeExporter commented 9 years ago
I know how to display the error message, however since the EpubDocument is 
being instantiated in epubviewer.Main.__init__, I'm not sure what would be the 
appropriate way to prevent the epub viewer window from opening.

Original comment by andresgattinoni on 25 Jan 2011 at 10:11

GoogleCodeExporter commented 9 years ago
Just throw an exception (ValueError?) and catch it on the caller.

Original comment by roberto.alsina on 25 Jan 2011 at 10:31

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 656b3f9b30.

Original comment by andresgattinoni on 25 Jan 2011 at 10:41