Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecial characters in audio devices name : Pyaudio
    primarykey
    data
    text
    <p>I'm currently facing a hard problem. I need to use Pyaudio on a french windows environnement and the name of the audio devices contains <code>é</code> or <code>è</code> by default. </p> <p>This is the error I get when a special character is present:</p> <pre><code> u=self.p.get_device_info_by_index(e) File "C:\Python27\lib\site-packages\pyaudio.py", line 977, in get_device_info_ by_index pa.get_device_info(device_index) File "C:\Python27\lib\site-packages\pyaudio.py", line 987, in _make_device_inf o_dictionary print device_info.name UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 13: invalid continuation byte </code></pre> <p>This wouldn't be a problem if I could access the code (I would need to add a u"..." in front of the string chain I guess). </p> <p>The problem is that I looked inside the Pyaudio code and the method causing the bug is defined in an pyd file (_portaudio.pyd), therefor, I can't modify it! </p> <p>I tried to download _portaudio to compile it myself, but the distribution I found is coded in C and quite heavy (I don't know the first thing about C). Maybe I could do something there but I don't know exactly where and how.</p> <p>I could also handle the problem by just commenting the line getting the name of the audio devices, but it's much harder to identify a specific audio input without its name to show to the user. </p> <p>EDIT :</p> <p>Here is the overall process : I call the function from pyaudio :</p> <pre><code> import pyaudio self.p= pyaudio.PyAudio() i=self.p.get_device_count() for e in range(i): u=self.p.get_device_info_by_index(e) </code></pre> <p>This will lead me into the pyaudio module which calls the method :</p> <pre><code>device_info.name </code></pre> <p>device_info being an object defined in _portaudio.pyd. Since the name of particular audio devices contain "é" or "è" (Thank you windows), and the _portaudio.pyd is not encoded to handle those characters. It returns the error :</p> <pre><code>UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 13: invalid continuation byte </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload