jwdj / EasyABC

EasyABC
GNU General Public License v2.0
87 stars 36 forks source link

Playing part of a tune not working OpenSUSE 15.4 Python 3.6 #64

Closed revad closed 1 year ago

revad commented 1 year ago

I describe my setup here https://github.com/jwdj/EasyABC/issues/63#issuecomment-1377202106 It will play tunes OK

I understand how loop play is meant to work from this https://sourceforge.net/p/easyabc/discussion/general/thread/d7ad9cfe95/ When I do that I get

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/wx/core.py", line 3407, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "/home/david/Documents/concertina/abc/easyABC/easyabc_source_1.3.8.6/easy_abc.py", line 7327, in PlayMidi
    tune, abc = self.GetAbcToPlay()
  File "/home/david/Documents/concertina/abc/easyABC/easyabc_source_1.3.8.6/easy_abc.py", line 4285, in GetAbcToPlay
    notes = get_notes_from_abc(text)
  File "/home/david/Documents/concertina/abc/easyABC/easyabc_source_1.3.8.6/easy_abc.py", line 487, in get_notes_from_abc
    abc = abc.encode()
AttributeError: 'bytes' object has no attribute 'encode'

The offending code in easy-abc.py 1.3.8.6:

486    if not isinstance(abc, str):
487        abc = abc.encode()

I tried commenting that out but it then fell over this:

    abc = abc.replace('\r', '\n')
TypeError: a bytes-like object is required, not 'str'
revad commented 1 year ago

This issue has been seen in Windows too: https://sourceforge.net/p/easyabc/tickets/46/

I made some amendments (4 lines changed) to easy-abc.py - attached: easy_abc.py.txt

This appears to work now on my Linux setup. Selecting a section of the music to play is a bit crude - especially on multi-voice tunes and across stave ends - but I've never seen this feature work so maybe it was always like that.

I'm unsure of the effect of changing the regex at (new) line 4301 from a raw string. As this concerns line-endings it might work differently in windows.

revad commented 1 year ago

This works in 1.3.8.7 - providing the selection is a single staff line.