ImportError: cannot import name 'AudioSegment'
See original GitHub issueHi, I installed pudub but I got the follow problem.
Steps to reproduce
Run one of these
import pydub
pydub.AudioSegment.ffmpeg = "C:\ffmpeg\bin"
from pydub import AudioSegment
Actual behavior
With the first one code I got.
runfile('E:/OneDrive - usach.cl/chillbot/pydub.py', wdir='E:/OneDrive - usach.cl/chillbot')
Traceback (most recent call last):
  File "<ipython-input-256-a38a65fe4502>", line 1, in <module>
    runfile('E:/OneDrive - usach.cl/chillbot/pydub.py', wdir='E:/OneDrive - usach.cl/chillbot')
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)
  File "E:/OneDrive - usach.cl/chillbot/pydub.py", line 7, in <module>
    import pydub
  File "E:\OneDrive - usach.cl\chillbot\pydub.py", line 8, in <module>
    pydub.AudioSegment.ffmpeg = "C:\ffmpeg\bin"
AttributeError: module 'pydub' has no attribute 'AudioSegment'
with the second I got.
runfile('E:/OneDrive - usach.cl/chillbot/pydub.py', wdir='E:/OneDrive - usach.cl/chillbot')
Traceback (most recent call last):
  File "<ipython-input-257-a38a65fe4502>", line 1, in <module>
    runfile('E:/OneDrive - usach.cl/chillbot/pydub.py', wdir='E:/OneDrive - usach.cl/chillbot')
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)
  File "E:/OneDrive - usach.cl/chillbot/pydub.py", line 7, in <module>
    from pydub import AudioSegment
  File "E:\OneDrive - usach.cl\chillbot\pydub.py", line 7, in <module>
    from pydub import AudioSegment
ImportError: cannot import name 'AudioSegment'
Your System configuration
- Python version: 3.6.1 64 bits, windows 10 with anaconda
 - Pydub version: The default by pip install
 - ffmpeg or avlib?: ffmpeg
 - ffmpeg/avlib version: FFmpeg 3.3 “Hilbert”
 
Issue Analytics
- State:
 - Created 6 years ago
 - Comments:7 (3 by maintainers)
 
Top Results From Across the Web
ImportError: cannot import name 'AudioSegment'
Having a file named pydub.py is a red flag. Try renaming it?
Read more >How to Fix : “ImportError: Cannot import name X” in Python
The following are the major reasons for the occurrence of "ImportError: cannot import name": The imported class is in a circular dependency. The...
Read more >ImportError: cannot import name 'AudioSegment' - Bountysource
Hi, I installed pudub but I got the follow problem. Steps to reproduce. Run one of these import pydub pydub.
Read more >signal_processing.py - Google Git
import numpy as np. except ImportError: logging.critical('Cannot import the third-party Python package numpy'). sys.exit(1). try: import pydub.
Read more >Python报错,发生异常: ImportError cannot import name ...
最近在使用python库pydub进行音频剪辑的时候,遇到了一个奇怪的问题, 发生异常: ImportError cannot import name 'AudioSegment' from 'pydub'
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

I’m not sure this is the issue, but having a file named
pydub.pyis a red flag. Try renaming it?Also having chunk.py filename is red flag. If you have same problem this may help you