name 'pydub' is not defined
See original GitHub issuePydub errors with Jupyter Notebook
from os import path
from pydub import AudioSegment
pydub.AudioSegment.converter = r"C:/ffmpeg/bin"
# Assign files
src = 'C:/Users/liora/Documents/Engineering/3rd Year/Individual project (EG3005)/Music Genre Classification/archive/songs/misunderstood_lucky_daye.mp3'
dst = "C:/Users/liora/Documents/Engineering/3rd Year/Individual project (EG3005)/Music Genre Classification/archive/songs/output.wav"
# Convert wav to mp3
sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")
The output I believe I should get is:
<_io.Bufferedrandom name='dst.wav'>
The error displayed:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-5-7a7c916717bd> in <module>
2 from pydub import AudioSegment
3
----> 4 pydub.AudioSegment.converter = r"C:/ffmpeg/bin"
5
6 # Assign files
NameError: name 'pydub' is not defined
My System configuration:
- Python version: 3.9.5
- Pydub version: 0.25.1
- ffmpeg or avlib?: ffmpeg
- ffmpeg/avlib version: 1.4
Is there an audio file you can include to help us reproduce?
I’m not sure how to attach it, but it’s an audio file that’s roughly 3 minutes long.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
NameError: name 'pydub' is not defined - Using Streamlit
Wassup Guys, I try to create a document file uploader that also supports audio files (wav, mp3). (Want to save uploaded file temporarily ......
Read more >Error with pydub in python - Stack Overflow
1 Answer 1 · 1. have you installed ffmpeg (ffmpeg.org)? · This library makes a call to the ffmpeg command. · i m...
Read more >ModuleNotFoundError: No module named ... - RoseIndia.Net
ModuleNotFoundError: No module named 'pydub' ... How to remove the ModuleNotFoundError: No module named 'pydub' error? ... Hi,. In your python environment you...
Read more >Working with wav files in Python using Pydub - GeeksforGeeks
wav audio files. Installation. This module does not come built-in with Python. To install it type the below command in the terminal. pip ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello. Hope youre doing great! The win error 5 youre getting seems to be windows folder permissions. I’d try to run the python script under admin privileges or change the path of the source file to a non “C” one because that’s where most of the permission issues arise. You could also try to change the permission settings on the path folder. windows defender or antivirus might scream at you so I usually avoid placing external files in “C”. look at this as well How to fix - Error 5: Access is Denied in Windows 10 - Microsoft Community https://answers.microsoft.com/en-us/windows/forum/all/how-to-fix-error-5-access-is-denied-in-windows-10/8a4069ea-4b0e-4517-9d7a-62c44b4d6e7d happy if I was any help Thanks.
On Tue, Jun 7, 2022 at 10:50 AM psylockes @.***> wrote:
Hello. I believe this is because you imported the AudioSegment object from pydub so you should reference it directly ie
AudioSegment.converter = r"C:/ffmpeg/bin"
If you wanted to reference it aspydub.AudioSegment.converter = r"C:/ffmpeg/bin"
change import statement toimport pydub