python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -


i'm using jupyter notebook. have tried anaconda console well.

tried importing both ways shown below

from moviepy.editor import videofileclip  moviepy.video.io.videofileclip import videofileclip 

both of them gave me same error. full trace below

attributeerror                            traceback (most recent call last) <ipython-input-10-9afa9d6e87c4> in <module>()       6 import glob       7 import math ----> 8 moviepy.editor import videofileclip       9 moviepy.video.io.videofileclip import videofileclip  c:\program files\anaconda3\lib\site-packages\moviepy\editor.py in <module>()      20 # clips      21  ---> 22 .video.io.videofileclip import videofileclip      23 .video.io.imagesequenceclip import imagesequenceclip      24 .video.io.downloader import download_webfile  c:\program files\anaconda3\lib\site-packages\moviepy\video\io\videofileclip.py in <module>()       1 import os       2  ----> 3 moviepy.video.videoclip import videoclip       4 moviepy.audio.io.audiofileclip import audiofileclip       5 moviepy.clip import clip  c:\program files\anaconda3\lib\site-packages\moviepy\video\videoclip.py in <module>()      18       19 import moviepy.audio.io aio ---> 20 .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video      21 .io.ffmpeg_tools import ffmpeg_merge_video_audio      22 .io.gif_writers import (write_gif,  c:\program files\anaconda3\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in <module>()      13     devnull = open(os.devnull, 'wb')      14  ---> 15 moviepy.config import get_setting      16 moviepy.tools import verbose_print      17   c:\program files\anaconda3\lib\site-packages\moviepy\config.py in <module>()      49     success, err = try_cmd([ffmpeg_binary])      50     if not success: ---> 51         raise ioerror(err.message +      52                  "the path specified ffmpeg binary might wrong")      53   attributeerror: 'permissionerror' object has no attribute 'message' 

python version info

python 3.5.2 |anaconda custom (64-bit)| (default, jul  5 2016, 11:41:13) [msc v.1900 64 bit (amd64)] on win32 type "help", "copyright", "credits" or "license" more information. 

running ffmpeg -version in console gives me

ffmpeg version n-83507-g8fa18e0 copyright (c) 2000-2017 ffmpeg developers built gcc 5.4.0 (gcc) configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib libavutil      55. 47.100 / 55. 47.100 libavcodec     57. 80.100 / 57. 80.100 libavformat    57. 66.102 / 57. 66.102 libavdevice    57.  2.100 / 57.  2.100 libavfilter     6. 73.100 /  6. 73.100 libswscale      4.  3.101 /  4.  3.101 libswresample   2.  4.100 /  2.  4.100 libpostproc    54.  2.100 / 54.  2.100 

i'm running 64 bit version of windows 10.

i can't find solution anywhere , driving me crazy! seems not finding ffmpeg binary have put in c:\ffmpeg\bin , added path environment variable. followed instruction here.

i had figure out myself tonight. there 2 parts error:

1> message attribute doesn't exist on exception object anymore in python 3, ,

2> guessed, need tell moviepy ffmpeg is

to work around err.message attribute error, can replace str(err):

    raise ioerror(str(err) +               "the path specified ffmpeg binary might wrong") 

but real solution make sure moviepy knows ffmpeg is. in moviepy\config_defaults.py file , see says ffmpeg_binary. default os.getenv('ffmpeg_binary', 'ffmpeg-imageio') means @ first value environment variable containing path of ffmpeg executable, , if not found use second value. 1 means should use ffmpeg installed imageio module.

since have ffmpeg installed somewhere on computer can set ffmpeg_binary variable in config_defaults.py point it:

ffmpeg_binary = "c:\ffmpeg\ffmpeg.exe" # ever on system 

or create environment variable value.

if hadn't installed ffmpeg, can install via imageio module used , installed moviepy. in moviepy install instructions, mention ffmpeg should installed automatically imageio, didn't happen me. when causes error, gives instructions install manually:

imageio.core.fetching.needdownloaderror: need ffmpeg exe. can download calling:   imageio.plugins.ffmpeg.download() 

this did, , didn't have edit config_defaults.py that. haven't used anaconda, doing in winpython type of python all-in-one distribution.

the reason came across error mis-entered path imagemagick in config_defaults.py, causing "raise" branch run, exposing python 2 code set err.message.

hope circuitous story helps or else.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -