Skip to content

AttributeError: 'PosixPath' object has no attribute 'write' #7

@mohammed-mostapha

Description

@mohammed-mostapha

as you stated in the readme file:
in the standalone dir, i used this code:

python spectrographic.py --image ./source.png --min_freq 10000 --max_freq 20000 --duration 10 --save sound.wav --play

and i am able to hear the output audio successfully, but after the audio playback finishes, i receive this error in terminal:

Traceback (most recent call last): File "spectrographic.py", line 457, in <module> run() File "spectrographic.py", line 453, in run main(sys.argv[1:]) File "spectrographic.py", line 447, in main sg.save(wav_file=args.save_file) File "spectrographic.py", line 173, in save wavio.write(wav_file, self.sound_array, self.SAMPLE_RATE) File "/home/mohamed/.local/lib/python3.8/site-packages/wavio.py", line 390, in write w.writeframes(wavdata) File "/usr/lib/python3.8/wave.py", line 438, in writeframes self.writeframesraw(data) File "/usr/lib/python3.8/wave.py", line 427, in writeframesraw self._ensure_header_written(len(data)) File "/usr/lib/python3.8/wave.py", line 468, in _ensure_header_written self._write_header(datasize) File "/usr/lib/python3.8/wave.py", line 472, in _write_header self._file.write(b'RIFF') AttributeError: 'PosixPath' object has no attribute 'write' Exception ignored in: <function Wave_write.__del__ at 0x7fd831e82820> Traceback (most recent call last): File "/usr/lib/python3.8/wave.py", line 327, in __del__ self.close() File "/usr/lib/python3.8/wave.py", line 445, in close self._ensure_header_written(0) File "/usr/lib/python3.8/wave.py", line 468, in _ensure_header_written self._write_header(datasize) File "/usr/lib/python3.8/wave.py", line 472, in _write_header self._file.write(b'RIFF') AttributeError: 'PosixPath' object has no attribute 'write'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions