[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] How to check sound format of mixer?



Marcus von Appen wrote:
On, Tue Feb 19, 2008, Lenard Lindstrom wrote:

[...]

[Broken Sound creation from file objects]
The following changes to examples\sound.py confirm it.

file = open(os.path.join('data', 'secosmic_lo.wav'), 'rb')
try:
   sound = mixer.Sound(file)
finally:
   file.close()

Running the modified sound.py raises an exception:

Traceback (most recent call last):
 File "sound.py", line 21, in <module>
   sound = mixer.Sound(file)
TypeError: expected a readable buffer object

Finally fixed in rev. 1123. Thanks to you both pointing me to it.
Shouldn't PyErr_Clear() be called to clear the error raised by PyObject_AsReadBuffer when the object is not a buffer?

--
Lenard Lindstrom
<len-l@xxxxxxxxx>