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 serhiy.storchaka
Recipients r.david.murray, serhiy.storchaka
Date 2013-11-16.11:44:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1384602280.29.0.166311165953.issue19623@psf.upfronthosting.co.za>
In-reply-to
Content
The aifc module documentation mentions that underlying file can be unseekable if the number of frames are specified.

   When
   used for writing, the file object should be seekable, unless you know ahead of
   time how many samples you are going to write in total and use
   :meth:`writeframesraw` and :meth:`setnframes`.

But this doesn't work.

>>> import aifc
>>> f = aifc.open('/dev/stdout', 'w')
>>> f.setnchannels(1)
>>> f.setsampwidth(1)
>>> f.setframerate(8000)
>>> f.setcomptype(b'NONE', b'not compressed')
>>> f.setnframes(1)
>>> f.writeframesraw(b'\0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/aifc.py", line 695, in writeframesraw
    self._ensure_header_written(len(data))
  File "/home/serhiy/py/cpython/Lib/aifc.py", line 763, in _ensure_header_written
    self._write_header(datasize)
  File "/home/serhiy/py/cpython/Lib/aifc.py", line 791, in _write_header
    self._form_length_pos = self._file.tell()
OSError: [Errno 29] Illegal seek

Here is a patch which makes the code to conform with the documentation.
History
Date User Action Args
2013-11-16 11:44:40serhiy.storchakasetrecipients: + serhiy.storchaka, r.david.murray
2013-11-16 11:44:40serhiy.storchakasetmessageid: <1384602280.29.0.166311165953.issue19623@psf.upfronthosting.co.za>
2013-11-16 11:44:40serhiy.storchakalinkissue19623 messages
2013-11-16 11:44:39serhiy.storchakacreate