TypeError in Note.from_int()
I am using node-python to wrap mingus modules and when I try to use Note.from_int() I get this error:
TypeError: list indices must be integers, not float
I could not find a way to pass an integer correctly from nodejs to mingus, but error is fixed by casting the integer either in the function mentioned or in notes.int_to_note().
Example code for reproducing:
var python = require('node-python');
var Note = python.import('mingus.containers.note').Note;
var n = Note();
console.log(n.from_int(20).toString());
Is there a way to solve this correctly?
Hi mutil,
I don't think it would be the responsible of int_to_note to convert strings to integers, so I think the way to go would be to do the conversion before calling into from_int. I'm not sure about the specifics of node-python however, but it seems to convert all numbers into floats, which does make sense for javascript. Maybe you can pass the float into python's int() function?