# Python: write .wav to chosen directory [closed]

I can only write .wav files to the current directory

fname = 'bassswoon.wav'
wav = wave.open(fname,'w')
wav.writeframes(struct.pack('h', bassswoon))
wav.close()


Adding a path to fname, i.e. fname = '/path/to/bassswoon.wav' does not work - the file is written neither in the intended directory ('/path/to/') nor in the working directory.

I don't see anything of use in the documentation - is it simply not possible with the wave object? Surely, there must be a way to hack it...

## closed as off-topic by Jason R, Peter K.♦Sep 9 '15 at 11:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "General programming questions are off-topic here, but can be asked on Stack Overflow." – Jason R, Peter K.
If this question can be reworded to fit the rules in the help center, please edit the question.

• This question is off-topic. You should post at Stack Overflow. – Jason R Sep 9 '15 at 11:34
• From what I can see, you are not writing, but you are trying to open... I suggest you to use scipy.io.wavfile module anyway. – jojek Sep 9 '15 at 11:37
• I thought it may be of interest to other people @ DSP – yunque Sep 9 '15 at 11:38
• @jojek see my edit for the rest of the code. I guess I may be looking at the wrong step in the process... will check scipy.io.wavfile – yunque Sep 9 '15 at 11:40