New submission from Thomas Jollans <tho...@jollans.com>: The sunau module, essentially, "doesn't work". This looks like a problem with the bytes/unicode transition of "str" in Python 3.x vs Python 2:
Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sunau >>> aufile = sunau.open('test.au', 'w') >>> aufile.setsampwidth(2) >>> aufile.setframerate(44100) >>> aufile.setnchannels(1) >>> aufile.writeframes(b'aabbccdd') Exception wave.Error: Error('# channels not specified',) in <bound method Wave_write.__del__ of <wave.Wave_write object at 0x1fa8ed0>> ignored Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.1/sunau.py", line 393, in writeframes self.writeframesraw(data) File "/usr/lib/python3.1/sunau.py", line 383, in writeframesraw self._ensure_header_written() File "/usr/lib/python3.1/sunau.py", line 418, in _ensure_header_written self._write_header() File "/usr/lib/python3.1/sunau.py", line 452, in _write_header self._file.write(self._info) TypeError: must be bytes or buffer, not str >>> The wave and aifc modules work as expected when used like this, as does the above code in Python 2.6. Au_read.readframes correctly returns a bytes. I haven't tested this on a development version of Python. ---------- components: Library (Lib) messages: 107081 nosy: tjollans priority: normal severity: normal status: open title: sunau bytes / str TypeError in Py3k type: behavior versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8897> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com