Message203026
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. |
|
Date |
User |
Action |
Args |
2013-11-16 11:44:40 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, r.david.murray |
2013-11-16 11:44:40 | serhiy.storchaka | set | messageid: <1384602280.29.0.166311165953.issue19623@psf.upfronthosting.co.za> |
2013-11-16 11:44:40 | serhiy.storchaka | link | issue19623 messages |
2013-11-16 11:44:39 | serhiy.storchaka | create | |
|