Issue when running code

Question: I’m getting this issue when running my code, which is strange, because this exact same code just worked earlier today. Also, I tested it exactly on my machine, and it ran successfully. I have a feeling this is Replit related.

Current behavior:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    from moviepy.editor import AudioFileClip
  File "/home/runner/Transcriber/venv/lib/python3.10/site-packages/moviepy/editor.py", line 36, in <module>
    from .video.io.VideoFileClip import VideoFileClip
  File "/home/runner/Transcriber/venv/lib/python3.10/site-packages/moviepy/video/io/VideoFileClip.py", line 3, in <module>
    from moviepy.audio.io.AudioFileClip import AudioFileClip
  File "/home/runner/Transcriber/venv/lib/python3.10/site-packages/moviepy/audio/io/AudioFileClip.py", line 3, in <module>
    from moviepy.audio.AudioClip import AudioClip
  File "/home/runner/Transcriber/venv/lib/python3.10/site-packages/moviepy/audio/AudioClip.py", line 4, in <module>
    from moviepy.editor import AudioFileClip
ImportError: cannot import name 'AudioFileClip' from partially initialized module 'moviepy.editor' (most likely due to a circular import) (/home/runner/Transcriber/venv/lib/python3.10/site-packages/moviepy/editor.py)

Desired behavior Successful running my code.

Repl link:

Transcriber - Replit

Perhaps your direct import of AudioFileClip is messing something up?
Try importing the editor before directly importing something.

import moviepy.editor

If that doesn’t work, check the versions of the package, and try uninstalling and reinstalling it.

2 Likes

I am not sure but when I look this up in your repl’s venv and online
I think you wanted to use moviepy.audio.AudioClip instead?

1 Like