Thijs Thijs - 3 months ago 47
Python Question

how to fix ImportError python

I have a file beginning with

from moviepy.editor import *
.
when I run this file I get the error:


Traceback (most recent call last):
File "moviepy.py", line 2, in

from moviepy.editor import *

File "/home/debian/Videos/moviepy.py", line 2, in

from moviepy.editor import *

ImportError: No module named editor


the strange thing is I am 100% sure moviepy is installed.
I checked sys.path and in one of the paths is a folder called moviepy with multiple files inside including __init__.py __init__.pyc and editor.py
so what am I doing wrong?

Answer

Your filename moviepy.py shadows installed package. Rename your main file and everything should work fine (if moviepy is installed in used interpreter).