This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tjollans
Recipients tjollans
Date 2010-06-04.17:34:53
SpamBayes Score 1.2015311e-10
Marked as misclassified No
Message-id <1275672895.91.0.97400241219.issue8897@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-06-04 17:34:55tjollanssetrecipients: + tjollans
2010-06-04 17:34:55tjollanssetmessageid: <1275672895.91.0.97400241219.issue8897@psf.upfronthosting.co.za>
2010-06-04 17:34:54tjollanslinkissue8897 messages
2010-06-04 17:34:53tjollanscreate