MatthiasLienhard / flowkey_dl

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

Can not load the sheet #7

Closed ztega closed 3 years ago

ztega commented 3 years ago

Hi,

Thanks for sharing your work! I get a KeyError that I haven't been able to solve (I'm a coding beginner so my troubleshooting is quite limited). On a mac, used python3 setup.py build and python3 setup.py install to install.

arage images of size 413x584
arage images of size 1652x2338
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Users/Joakim/anaconda3/lib/python3.6/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/Users/Joakim/anaconda3/lib/python3.6/site-packages/flowkey_dl-0.0.2-py3.6.egg/flowkey_dl/flowkey_dl_gui.py", line 116, in load
    self.image,title, artist=flowkey_dl(url)
  File "/Users/Joakim/anaconda3/lib/python3.6/site-packages/flowkey_dl-0.0.2-py3.6.egg/flowkey_dl/flowkey_dl.py", line 17, in flowkey_dl
    filename=pkg_resources.resource_filename(__name__, f'raw/{hashstring}.png')
  File "/Users/Joakim/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1137, in resource_filename
    self, resource_name
  File "/Users/Joakim/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1644, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "/Users/Joakim/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1665, in _extract_resource
    timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'flowkey_dl/raw/t9jdnLr9Qw7Swu6Td.png'

I tried to run flowkey_dl.pywith an edited url without success:

Joakims-MBP-4:flowkey_dl Joakim$ python flowkey_dl.py 
/Users/Joakim/anaconda3/lib/python3.6/site-packages/PIL/Image.py:914: UserWarning: Palette images with Transparency   expressed in bytes should be converted to RGBA images
  'to RGBA images')
loaded patch 0 with shape (384, 1024)
patch 0 looks strange, ignoring: [[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]] 
shape: (384, 1024)
loaded patch 1 with shape (384, 1024)
patch 1 looks strange, ignoring: [[0 0 0 ... 0 0 0]

...

shape: (384, 1024)
loaded patch 43 with shape (384, 516)
patch 43 looks strange, ignoring: [[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]] 
shape: (384, 516)
downloaded 0 patches form https://flowkeycdn.com/sheets/JxD8S3qsfD8papddW/300/{}.png
Traceback (most recent call last):
  File "flowkey_dl.py", line 185, in <module>
    main()
  File "flowkey_dl.py", line 177, in main
    image=flowkey_dl(url)
  File "flowkey_dl.py", line 43, in flowkey_dl
    imgs_comb = np.hstack( imgs  )
  File "/Users/Joakim/anaconda3/lib/python3.6/site-packages/numpy/core/shape_base.py", line 288, in hstack
    return _nx.concatenate(arrs, 1)
ValueError: need at least one array to concatenate

Any ideas? Appreciate any help I get.

ztega commented 3 years ago

Issue was related to packages out of date. I'd recommend to add lowest required version in 'requirements.txt'.

MatthiasLienhard commented 3 years ago

Sure, I'll add it if you let me know which package and what version is required.

ztega commented 3 years ago

I don't know the lowest compatible level but following versions did not work:

numpy == 1.14.3
imageio == 2.3.0
Pillow == 5.1.0

This is ok:

requests >= 2.18.4
numpy >= 1.18.5
imageio >= 2.9.0
Pillow >= 7.2.0