MidiToText : EventDispatcher instance has no attribute 'sysex_events'
tim
info at timvets.net
Fri Dec 30 12:49:14 EST 2005
Carsten Haese wrote:
> On Fri, 2005-12-30 at 09:52, tim wrote:
>
>
>> Trying to convert midi to text using MidiToText.py.
>> I get the following:
>>
>> midi_port: 0
>> Traceback (most recent call last):
>> File "MidiToText.py", line 176, in ?
>> midiIn.read()
>> File "C:\Python24\Lib\site-packages\midi\MidiInFile.py", line 24, in
>> read
>> p.parseMTrkChunks()
>> File "C:\Python24\Lib\site-packages\midi\MidiFileParser.py", line
>> 167, in parseMTrkChunks
>> self.parseMTrkChunk() # this is where it's at!
>> File "C:\Python24\Lib\site-packages\midi\MidiFileParser.py", line
>> 129, in parseMTrkChunk
>> dispatch.sysex_events(sysex_data)
>> AttributeError: EventDispatcher instance has no attribute 'sysex_events'
>>
>
>
> Try changing "def sysex_event(self, data):" in
> ...\midi\EventDispatcher.py to "def sysex_events(self, data):"
>
> Hope this helps,
>
> Carsten.
>
>
>
>
>
Yes thank Carsten! it works.
Now I am trying to generate a string or a list from the output of
MidiToText instead of printing to the console.
I tried simply replacing the "print" in MidiToText by "return"
everywhere, and renamed it to MidiToTextFile so that I would be able to do:
for test_file in fulldir:
f = open(test_file, 'rb')
# do parsing
from MidiInFile import MidiInFile
midiIn = MidiInFile(MidiToTextFile(), f)
f.close()
outmidtxt.write(midiIn.read())
or something, to have the text version of several midi's written into
one large textfile, but I got lost somewhere along the way....
how to do this?
...thanks again
-------------- next part --------------
An embedded message was scrubbed...
From: tim <info at timvets.net>
Subject: Re: MidiToText : EventDispatcher instance has no attribute 'sysex_events'
Date: Fri, 30 Dec 2005 18:38:40 +0100
Size: 2223
URL: <http://mail.python.org/pipermail/python-list/attachments/20051230/bf569282/attachment.mht>
More information about the Python-list
mailing list