I was having trouble importing a certain python module into julia for
realtime interactions...
and painfully worked out what looks to be a good general rule-of-thumb:
Write your own module (and put it into python's path) in which you don't
try to do anything complex that would require figuring conversions from
your own python code to julia types. The module should simply translate
python method calls into python functions.
example:
mymod.py
will have:
import theirmod
myf(x):
ans= x.theirmethod
return ans
...
while back in julia you can call their method on a python object x
by saying:
ans= mymod.myf(x)
----------------------------
like so:
julia> using PyCall
julia> @pyimport mymid
julia> inp = mymid.openp()
PyObject <open input 'Q25 MIDI 1' (PortMidi/ALSA)>
julia> x = mymid.iter(inp)
(6,Any[54,0,77,51,0,0],Any[60,60,62,60,60,62])