mido / mido

MIDI Objects for Python
https://mido.readthedocs.io
MIT License
1.41k stars 211 forks source link

OSError: [WinError 126] The specified module could not be found #46

Closed hippolyte-dubois closed 7 years ago

hippolyte-dubois commented 8 years ago

Hi, I'm trying to open a virtual output port but this error is raised when i try to do so. From the installation guide i've understand that i need portmidi.dll, but there's no download link, and google doesn't know the answer either.

Do i need to install portmidi (if i could avoid it that would be amazing, the VStudio solution is broken) or do i only need one dll ?

What do I need to do ?

olemb commented 8 years ago

PortMidi doesn't support virtual ports so you'll have to switch to RtMidi. Not only does it have more features but it looks like it's easier to install in Windows:

http://trac.chrisarndt.de/code/wiki/python-rtmidi/install

Once you've got it installed here's how to use it with Mido:

https://mido.readthedocs.io/en/latest/backends.html#rtmidi
hippolyte-dubois commented 8 years ago

"Trac Error Page python-rtmidi/install not found"

I since moved to a pygame backend with LoopMIDI to create my virtual ports. It works fine except that i get the following error : RuntimeError: pygame.midi not initialised.

I tried using mido.set_backend('mido.backends.pygame',load=True) but this error is raised : TypeError: set_backend() got an unexpected keyword argument 'load'

What am i doing wrong ?

olemb commented 8 years ago

Where are you getting the "Trac Error"?

Aha, you're not creating the virtual port with Mido, just connecting to it? Then any backend will do.

I'll look into adding a load argument to set_backend(). Here's a workaround if you want the module loaded right away:

mido.set_backend('mido.backends.pygame')
mido.backend.load()

(If you don't load the module it will be loaded when you start using it.)

hippolyte-dubois commented 8 years ago

I'm getting the Trac Error when going to http://trac.chrisarndt.de/code/wiki/python-rtmidi/install

Yes, that's why I chosed pygame, easier to install.

I added the load() instruction, but still, same error. Full trace : Exception ignored in: <bound method BasePort.__del__ of <open output 'Wi-Micro_1' (Pygame/b'MMSystem')>> Traceback (most recent call last): File "C:\Users\Hippolyte\AppData\Local\Programs\Python\Python35-32\lib\site-packages\mido\ports.py", line 74, in __del__ File "C:\Users\Hippolyte\AppData\Local\Programs\Python\Python35-32\lib\site-packages\mido\ports.py", line 70, in close File "C:\Users\Hippolyte\AppData\Local\Programs\Python\Python35-32\lib\site-packages\mido\backends\pygame.py", line 95, in _close File "C:\Users\Hippolyte\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pygame\midi.py", line 431, in close File "C:\Users\Hippolyte\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pygame\midi.py", line 98, in _check_init RuntimeError: pygame.midi not initialised.

olemb commented 8 years ago

Wow, there's a space at the end of the Trac URL for some reason. Try this:

http://trac.chrisarndt.de/code/wiki/python-rtmidi/install%20

I think you need to install pygame.midi separately, but I'm not sure. (I've only ever used Mido on Linux and Mac.)

What happens if you do:

import pygame.midi
olemb commented 7 years ago

Hi,

I hope you've found a solution to this.

Looking over your issue now I realize that somehow I misread the error message. I though it said "pygame.midi not installed" while it clearly says "pygame.midi not initialised".

This should work:

pygame.midi.init()
cjappl commented 7 years ago

@IgorDubois Has this issue been solved? There has been no action for some time

cjappl commented 7 years ago

Moving to close stale issue