How can I use this Python module in Blender?

I know this question has been asked before (for instance, here: Using 3rd party Python modules), but The answers aren't getting me where I need to be. I'm not an expert, so I might need a little more hand-holding (sorry).

I have a script that works outside of blender that uses "python-midi" (found here: https://github.com/vishnubob/python-midi), but I can't get it to run in Blender.

I tried moving the "python-midi-master" folder into Blender/Contents/MacOS/2.70/python/lib/python3.3 but it didn't seem to make a difference. I also tried deleting that folder (to make Blender fall back on the system's Blender?) but that didn't work either.

I'm running Mac OS 10.8 with Blender 2.7 and Python 3.4.1

The midi library seems to be only for Python 2.x. Whereas Blender runs off Python 3.3. But if you are adventurous enough, you can probably get it working.

1. Installation:

Download the source from Github. Copy the src folder from the package into blender.app/Contents/MacOS/2.70/python/lib/python3.3/site-packages/ and rename the src directory as midi

2. Auto Convert to Python 3 syntax

Run 2to3 * -w on the midi folder, to automatically convert as much of the code as possible to Py3k. The 2to3 command should come with a system installation of Python3.

3. Manual Fixin'

At this point, you should be able to at least get Blender to recognize the library. Fix errors as you encounter them.

Good luck!

• I'm like 99% sure this works, but I'm getting this error now: ValueError: 'pitch' in slots conflicts with class variable which I'm pretty sure comes from the conversion from 2 to 3. Am I pretty much out of luck at this point? I guess there are no MIDI parsers for Python 3. – jemtan990 Jun 12 '14 at 21:52
• That's where I go too. Might have to refactor some of the code to make it work. Sorry I wouldn't help you more. – Mike Pan Jun 12 '14 at 23:14
• No, I appreciate your help. I guess I'll have to figure out something else. I wonder how hard it would be to just read the midi file myself? – jemtan990 Jun 12 '14 at 23:23
• Does anybody have a solution for this socket crap? Maybe some guru python could suggest some hack, even ugly will work for me! – piotao Apr 30 '16 at 1:27