control: severity -1 important
control: tags -1 patch

On Sun, Aug 16, 2020 at 02:58:30PM +0300, Alexander Inyukhin wrote:
> Package: fbless
> Version: 0.2.3-4
> Severity: normal
> 
> fbless failed to open files with exception
> 
> Traceback (most recent call last):
>   File "/usr/bin/fbless", line 23, in <module>
>     MainWindow().main_loop()
>   File "/usr/lib/python3/dist-packages/fbless_lib/main.py", line 79, in 
> __init__
>     self.content = create_content(self.filename, curses.COLS)
>   File "/usr/lib/python3/dist-packages/fbless_lib/main.py", line 1073, in 
> create_content
>     if data.startswith('<?xml'):
> TypeError: startswith first arg must be bytes or a tuple of bytes, not str

This is because python3 patch is not complete.  As a result, opening
of zip files (which seems to be the most common way fb2 files are
used) is broken.  Fortunately the fix is trivial:


--- fbless-0.2.3.orig/fbless_lib/main.py
+++ fbless-0.2.3/fbless_lib/main.py
@@ -1070,7 +1070,7 @@ def create_content(filename, scr_cols):
         zf = zipfile.ZipFile(filename)
         for zip_filename in zf.namelist():
             data = zf.read(zip_filename)
-            if data.startswith('<?xml'):
+            if data.startswith(b'<?xml'):
                 break
         else:
             sys.exit('zip archive: xml file not found')

Reply via email to