-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed as duplicate of#75593
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Scenario 1 - Opening the file for reading
# Opening the file for reading
import wave
from pathlib import Path
AUDIO_FILE = Path("sound.wav")
with wave.open(AUDIO_FILE, "rb") as wave_read:
passOutput:
AttributeError: 'PosixPath' object has no attribute 'read'Scenario 2 - Opening the file for writing
# Opening a file for writing
import wave
from pathlib import Path
AUDIO_FILE = Path("sound.wav")
with wave.open(AUDIO_FILE, "wb") as wave_write:
wave_write.setnchannels(1)
wave_write.setsampwidth(2)
wave_write.setframerate(44100)Output:
AttributeError: 'PosixPath' object has no attribute 'write'. Did you mean: 'drive'?CPython versions tested on:
3.14
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error