MatthiasLienhard / flowkey_dl

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

Error while loading #39

Open keyeb22 opened 4 months ago

keyeb22 commented 4 months ago

Hi,

I tried to use the app, but no matter what I do.. I keep getting this same Error:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python38\lib\tkinter__init.py", line 1892, in call return self.func(*args) File "C:\Program Files\Python38\lib\site-packages\flowkey_dl-0.1.10-py3.8.egg\flowkey_dl\flowkey_dl_gui.py", line 148, in load self.image, title, artist = flowkey_dl(url) File "C:\Program Files\Python38\lib\site-packages\flowkey_dl-0.1.10-py3.8.egg\flowkey_dl\flowkey_dl.py", line 15, in flowkey_dl filename = pkg_resources.resource_filename( File "C:\Program Files\Python38\lib\site-packages\pkg_resources__init__.py", line 1143, in resource_filename return get_provider(package_or_requirement).get_resource_filename( File "C:\Program Files\Python38\lib\site-packages\pkg_resources\init.py", line 1754, in get_resource_filename return self._extract_resource(manager, zip_path) File "C:\Program Files\Python38\lib\site-packages\pkg_resources\init__.py", line 1775, in _extract_resource timestamp, size = self._get_date_and_size(self.zipinfo[zip_path]) KeyError: 'flowkey_dl\raw\300.png'

flowkey-dl is installed via pip I get the same error message (without the Tkinter Exception) when I try to use CLI I already tried different python versions (at the moment 3.8) and different versions of the packages (as there were some issues in the past) The URL of the Songs does not look like in the readme. It looks like https://cdn.flowkey.com/sheets/XXXXXXXXXXXXXXX/300/0.png Also to say I am new with Python...

Can you help me here?

CarnivoreD commented 1 month ago

Unfortunately I have the same problem - is there any solution to this?

Thank you...

MatthiasLienhard commented 1 month ago

I'll lock into this at some point but I have little time currently. Does this happen with all songs, or only some? If so, which?

CarnivoreD @.***> schrieb am Sa., 13. Juli 2024, 08:19:

Unfortunately I have the same problem - is there any solution to this?

Thank you...

— Reply to this email directly, view it on GitHub https://github.com/MatthiasLienhard/flowkey_dl/issues/39#issuecomment-2226792580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGJWC2I7GHI5AJDQZKMQTFTZMDBHXAVCNFSM6AAAAABFZFQRGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWG44TENJYGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CarnivoreD commented 1 month ago

Thank you, Matthias.

At the moment I can't tell because I deinstalled Python and reinstalled the current version (over MS Store). When installing flow-dl with the Windows-Terminal it says "Defaulting to user installation because normal site-packages is not writeable". When trying to start it says "Der Befehl "flowkey_dl" ist entweder falsch geschrieben oder konnte nicht gefunden werden." I do not really know what do do anymore to get it fixed again...

keyeb22 commented 1 month ago

For me it happened with all songs i tried. For example Moonlight Sonata (int).

CarnivoreD commented 1 month ago

Now I managed to fix it and can confirm that it happens with all songs (Url always looks like https://cdn.flowkey.com/sheets/XXXXXXXXXXXXXXX/300/0.png)...

anetteIversen commented 2 weeks ago

Hi Matthias

Thank you so much for taking the time to create flowkey. To play from the printet notes really makes a difference to me. Currently I am making screenshots and stitching them in photoshop, but thought there must be a better way - and so I found your github :-) Unfortunately I've experienced similar problems as the above. Hope to hear from you when you get more time on your hands :-)

here's a bit of info

process

terminal output

(base) mbp14:~ anette$ flowkey-dl-cli https://cdn.flowkey.com/rendered-sheets/CcsyxqPKMML6EeAg3/d768f56e/0@2x.png /Users/anette/Downloads
loaded patch 0 with shape (285, 1024, 4)
loaded patch 1 with shape (285, 1024, 4)
loaded patch 2 with shape (285, 815, 4)
downloaded 3 patches form https://cdn.flowkey.com/rendered-sheets/CcsyxqPKMML6EeAg3/d768f56e/{}@2x.png
arage images of size 2480x3508
found 8 measures
29, 2160
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/flowkey-dl-cli", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/flowkey_dl/flowkey_dl_cli.py", line 32, in main
    processed_image = arange_image(image, title, artist)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/flowkey_dl/flowkey_dl.py", line 171, in arange_image
    patch = patch.resize((int(x * scale) for x in reversed(dim)))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 2328, in resize
    return self._new(self.im.resize(size, resample, box))
TypeError: argument 1 must be 2-item sequence, not generator
MatthiasLienhard commented 2 weeks ago

I guess these are separate issues, the TypeError: argument 1 must be 2-item sequence, not generator is probably related to the PIL version, but can be easily fixed.

The other one is probably related to Windows path names, and I do not have windows installed, so its much more difficult for me.

MatthiasLienhard commented 2 weeks ago

@anetteIversen can you please test the outcome with v0.1.11 (install from git) I tested on macbook, and all urls you sent worked (also in the gui).

anetteIversen commented 2 weeks ago

Sure thing, Mattias - pls. find the output with v0.1.11 below. It seems like my PIL is an issue now; unknown file extension

my PIL version __init__.py Pillow is forked from PIL 1.1.7.

_version.py version = "10.4.0"

(base) mbp14:flowkey_dl anette$ flowkey-dl-cli https://cdn.flowkey.com/rendered-sheets/CcsyxqPKMML6EeAg3/d768f56e/0@2x.png /Users/anette/Downloads
loaded patch 0 with shape (285, 1024, 4)
loaded patch 1 with shape (285, 1024, 4)
loaded patch 2 with shape (285, 815, 4)
downloaded 3 patches form https://cdn.flowkey.com/rendered-sheets/CcsyxqPKMML6EeAg3/d768f56e/{}@2x.png
arage images of size 2480x3508
found 8 measures
29, 2160
2159, 2863
saving 1 pages to /Users/anette/Downloads
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 2543, in save
    format = EXTENSION[ext]
KeyError: ''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/flowkey-dl-cli", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/flowkey_dl/flowkey_dl_cli.py", line 33, in main
    save_pdf(processed_image, pdf_path)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/flowkey_dl/flowkey_dl.py", line 221, in save_pdf
    images[0].save(filename)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 2546, in save
    raise ValueError(msg) from e
ValueError: unknown file extension: 
anetteIversen commented 2 weeks ago

Sooo - testet flowkey-dl instead and everything loads fine - only issue was to save the pdf. As it turned out it didnt have a 'raw' folder in; /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/flowkey_dl/

Created a 'raw' folder and now everything executes effortlessly - thank you so much, Matthias - you made my day and rescued my piano sessions :-D

(base) mbp14:~ anette$ flowkey-dl
2024-08-13 15:09:22.712 Python[87939:3457438] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
arage images of size 413x584
arage images of size 1652x2338
loaded patch 0 with shape (285, 1024, 4)
loaded patch 1 with shape (285, 1024, 4)
loaded patch 2 with shape (285, 1024, 4)
loaded patch 3 with shape (285, 948, 4)
downloaded 4 patches form https://cdn.flowkey.com/rendered-sheets/JDr3be4fKpfiTBXBh/8ed7020d/{}@2x.png
arage images of size 1652x2338
found 16 measures
29, 1393
1392, 2801
2800, 4020
saving raw image of sheet Traditionel - When the Saints to /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/flowkey_dl/raw/https:.png
saving 1 pages to /Users/anette/Downloads/traditionel_when_the_saints.pdf
flowkey-dl-cli https://cdn.flowkey.com/rendered-sheets/CcsyxqPKMML6EeAg3/d768f56e/0@2x.png /Users/anette/Downloads
dfriggin commented 2 weeks ago

edit Line 171 of flowkey_dl.py I updated my local copy of the code to: patch = patch.resize(tuple(int(x * scale) for x in reversed(dim)))

Adding the "tuple" seems to fix the problem below.

I also had a problem when I went to save the PDF where I had to add the "raw" folder manually to save the PDF otherwise I got a blank PDF. BUT it's working again for me now!

Love the tool btw! *end edit**

I just created a new environment and reinstalled everything on my Windows machine and having the same issue as OP running the GUI version. Are the any stable configurations / combinations others are running now?

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\lewis\anaconda3\Lib\tkinter\__init__.py", line 1968, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\lewis\anaconda3\Lib\tkinter\__init__.py", line 862, in callit
    func(*args)
  File "C:\Users\lewis\PycharmProjects\Sheet Music\.venv\Lib\site-packages\flowkey_dl\flowkey_dl_gui.py", line 231, in _get_preview
    self.processed_images = self.get_images()
                            ^^^^^^^^^^^^^^^^^
  File "C:\Users\lewis\PycharmProjects\Sheet Music\.venv\Lib\site-packages\flowkey_dl\flowkey_dl_gui.py", line 201, in get_images
    return arange_image(
           ^^^^^^^^^^^^^
  File "C:\Users\lewis\PycharmProjects\Sheet Music\.venv\Lib\site-packages\flowkey_dl\flowkey_dl.py", line 171, in arange_image
    patch = patch.resize((int(x * scale) for x in reversed(dim)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lewis\PycharmProjects\Sheet Music\.venv\Lib\site-packages\PIL\Image.py", line 2328, in resize
    return self._new(self.im.resize(size, resample, box))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^