[New-bugs-announce] [issue46905] winsound.PlaySound should accept pathlib.Path instances

Julian report at bugs.python.org
Wed Mar 2 19:02:59 EST 2022


New submission from Julian <github at somethinkodd.com>:

The library function winsound.PlaySound takes a sound parameter. One of the valid arguments is a path to a WAV filename.

Since Python 3.4, paths can be cleanly represented with PathLib.Path instances.

However, if you pass a Path instance to PlaySound, it responds with:

   TypeError: 'sound' must be str or None, not 'WindowsPath'

This can be quickly fixed in the caller by passing str(the_path_instance) instead, but it would be cleaner if PlaySound accepted Python's preferred method of representing paths.

----------
components: Library (Lib)
messages: 414393
nosy: Julian-O
priority: normal
severity: normal
status: open
title: winsound.PlaySound should accept pathlib.Path instances
type: enhancement

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46905>
_______________________________________


More information about the New-bugs-announce mailing list