[New-bugs-announce] [issue19623] Support for writing aifc to unseekable file
Serhiy Storchaka
report at bugs.python.org
Sat Nov 16 12:44:40 CET 2013
New submission from Serhiy Storchaka:
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.
----------
components: Library (Lib)
files: aifc_write_unseekable.patch
keywords: patch
messages: 203026
nosy: r.david.murray, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Support for writing aifc to unseekable file
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file32649/aifc_write_unseekable.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19623>
_______________________________________
More information about the New-bugs-announce
mailing list