New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect division in [wave.py] #51930
Comments
CPython 3.1.1 in Windows XP. Traceback (most recent call last):
File "C:\Documents and Settings\Alf\sound\error.py", line 6, in <module>
writer.setframerate( framerate )
NameError: name 'framerate' is not defined
Exception wave.Error: Error('sampling rate not specified',) in <bound method Wave_write.__del__ of <wave.Wave_write obje
ct at 0x00FE87F0>> ignored TO FIX: "/" needs to be changed to "//" in lines and 243 464 of [wave.py] |
Sorry, here's correct error message: Traceback (most recent call last):
File "C:\Documents and Settings\Alf\sound\error.py", line 8, in <module>
writer.writeframes( b"\0"*2*4 )
File "C:\Program Files\cpython\python31\lib\wave.py", line 432, in writeframes
self.writeframesraw(data)
File "C:\Program Files\cpython\python31\lib\wave.py", line 416, in writeframesraw
self._ensure_header_written(len(data))
File "C:\Program Files\cpython\python31\lib\wave.py", line 459, in _ensure_header_written
self._write_header(datasize)
File "C:\Program Files\cpython\python31\lib\wave.py", line 472, in _write_header
self._sampwidth * 8, 'data'))
struct.error: required argument is not an integer
Exception struct.error: 'required argument is not an integer' in <bound method Wave_write.__del__ of <wave.Wave_write ob
ject at 0x00FE87F0>> ignored |
In your example, the "n_frames" name does not exist, which is causing the problem. In your first comment, "framerate" also did not exist. I don't know what a proper frame rate value is, but I just put 10 in there and it worked fine. Can you confirm? |
No, sorry, the bugs in [wave.py] have nothing to do with a name IN A COMMENT in the trivial code to exercise the bugs. To reproduce the crash, just run the supplied code with Python 3.1.1 in Windows XP. The cause of the crash is, as I pointed out, use of Python 2.x "/" division instead of Python 3.x "//" division. The author of [wave.py] had fixed that in some places. But he/she forgot two places. Cheers & hth.,
|
There is no crash, but I see what you are saying now. |
Thanks for the patch! Applied in r77459. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: