ctypes, error when calling function

Richie Hindle richie at entrian.com
Thu Oct 7 15:09:40 CEST 2004


> AttributeError: function 'midiOutGetDevCaps' not found

Like a lot of Windows APIs, midiOutGetDevCaps exists in both ANSI and
Unicode variants.  You need to call midiOutGetDevCapsA or
midiOutGetDevCapsW according to whether you're using ANSI or Unicode.

Because you're using c_char in your MIDIOUTCAPS structure:

> ("szPname", c_char * MAXPNAMELEN)

you need to call the ANSI variant, midiOutGetDevCapsA.

When you're programming Windows in C, the API header files define
midiOutGetDevCaps to be either midiOutGetDevCapsA or midiOutGetDevCapsW
according to whether you're compiling an ANSI or Unicode application.
This is why any C-based sample code you might see doesn't have this
problem.

-- 
Richie Hindle
richie at entrian.com




More information about the Python-list mailing list