Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import wave library in python? [duplicate]

I tried to import in my code library wave (istalled by pip) like this:

import wave

And next what I used in my program is

raw = wave.open('file.wav', 'rb')

After run my program in console I had this wierd problem:

AttributeError: 'module' object has no attribute 'open'

What is the problem?

like image 956
Radosław Rosłaniec Avatar asked Nov 19 '25 01:11

Radosław Rosłaniec


1 Answers

You probably have a local file named wave.py that is being imported instead.

Check with:

import wave

print wave.__file__

and rename or delete that file.

like image 185
Martijn Pieters Avatar answered Nov 21 '25 15:11

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!