MatthiasLienhard / flowkey_dl

helper to create sheet music from flowkey songs
MIT License
70 stars 15 forks source link

Error "ValueError: Could not find a backend to open `<bytes>`` with iomode `ri`." when loading a song #37

Closed JeremyTaieb1 closed 8 months ago

JeremyTaieb1 commented 9 months ago

Hello,

I have an error when trying to donwload sheets, i took this one as an example but its the same with other ones.

Brahms Lullaby in medium difficulty : https://cdn.flowkey.com/sheets/vSWc6EqSsS2fYqsWE/300/0.png

Here is the CMD output when trying to load it :

arage images of size 413x584 arage images of size 1652x2338 loaded patch 0 with shape (318, 1024, 4) loaded patch 1 with shape (318, 1024, 4) loaded patch 2 with shape (318, 1024, 4) loaded patch 3 with shape (318, 1024, 4) loaded patch 4 with shape (318, 1024, 4) loaded patch 5 with shape (318, 1024, 4) loaded patch 6 with shape (318, 775, 4) Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python312\Lib\tkinter__init.py", line 1962, in call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\Users\Jeremy\AppData\Roaming\Python\Python312\site-packages\flowkey_dl\flowkey_dl_gui.py", line 148, in load self.image, title, artist = flowkey_dl(url) ^^^^^^^^^^^^^^^ File "C:\Users\Jeremy\AppData\Roaming\Python\Python312\site-packages\flowkey_dl\flowkey_dl.py", line 33, in flowkey_dl patch = imageio.imread(r.content, format='png', pilmode="RGBA") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jeremy\AppData\Roaming\Python\Python312\site-packages\imageio__init__.py", line 97, in imread return imread_v2(uri, format=format, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jeremy\AppData\Roaming\Python\Python312\site-packages\imageio\v2.py", line 359, in imread with imopen(uri, "ri", imopen_args) as file: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jeremy\AppData\Roaming\Python\Python312\site-packages\imageio\core\imopen.py", line 281, in imopen raise err_type(err_msg) ValueError: Could not find a backend to open <bytes>`` with iomoderi`.

Cheers, your program is usually awesome when its working =)

hannah-jj commented 9 months ago

This will be fixed by this PR - https://github.com/MatthiasLienhard/flowkey_dl/pull/36. Since a different error message "Not Found" is returned when the next image in the series is not found, the while loop didn't break and the code proceeded to this line patch = imageio.imread(r.content, format='png', pilmode="RGBA") thus causing the error you've seen.

JeremyTaieb1 commented 9 months ago

Ok thank you for the quick reply