1
$\begingroup$

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

$\endgroup$

1 Answer 1

2
$\begingroup$

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!

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – jemtan990
    Commented Jun 12, 2014 at 21:52
  • $\begingroup$ 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. $\endgroup$
    – Mike Pan
    Commented Jun 12, 2014 at 23:14
  • $\begingroup$ 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? $\endgroup$
    – jemtan990
    Commented Jun 12, 2014 at 23:23
  • $\begingroup$ Does anybody have a solution for this socket crap? Maybe some guru python could suggest some hack, even ugly will work for me! $\endgroup$
    – piotao
    Commented Apr 30, 2016 at 1:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .