2

i'm a newbie with Raspberry PI (my model is B+). I'm tryng to write a script in python that read a midi file and switch on/off leds... My code for reading midi file is this one:

import mido
output = mido.open_output()
from mido import MidiFile

mid = MidiFile('stan.mid')

for message in MidiFile(mid).play():
    output.send(message)

but when i execute the script i have this error:

OSError: libportmidi.so: cannot open shared object file: No such file or directory

looking into raspberry i find the library into /user/lib folder under libportmidi.so.0 name.

What's wrong??

4
  • I can't find the Python module mido. Is it something you have written yourself?
    – joan
    Commented May 2, 2015 at 14:06
  • no, i downloaded it: mido.readthedocs.org/en/latest
    – ntrax
    Commented May 3, 2015 at 10:28
  • That's a risk if you download something not in the repositories. The software from the standard repositories play nicely together with consistent libraries. You may have to wait for someone else who uses that package for a solution.
    – joan
    Commented May 3, 2015 at 10:57
  • Could you try `find -name "libportmidi.so" I suspect Python cannot find the lib.so file. Commented Jun 3, 2015 at 0:25

2 Answers 2

2

Try to sim link to the .0 copy of the library.

sudo ln -s /usr/lib/libportmidi.so.0 /usr/lib/libportmidi.so

2
  • this did the trick for me Commented Jun 19, 2016 at 20:22
  • worked for me, too. Essentially I needed sudo apt-get install libasound2-dev sudo apt-get install libjack-dev sudo pip install --pre python-rtmidi sudo ln -s /usr/lib/libportmidi.so.0 /usr/lib/libportmidi.so .
    – dirkk0
    Commented Oct 30, 2016 at 9:47
2

I had similar problems using mido on Ubuntu. Just fixing the symbolic link 'libportmidi.so' ws not sufficient. Removing Timidity++ and re-installing plain old Timidity fixed it for me.

By the way, 'mido' really is a bona fide quality python package with good documentation available form the 'site formerly known as the cheese shop'. see:

https://pypi.python.org/pypi/mido/1.1.14

I can provide samples on how I got mido working for my own purposes on request.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.