moviepy执行TextClip.search方法时报错TypeError: a bytes-like object is required, not str

☞ ░ 前往老猿Python博文目录 ░

执行TextClip.search方法时,报错:

>>> from  moviepy.editor import *
>>> TextClip.search('red','color')
Traceback (most recent call last):
  File "", line 1, in <module>
    TextClip.search('red','color')
  File "C:\Program Files\Python37\lib\site-packages\moviepy\video\VideoClip.py", line 1197, in search
    return [name for name in names_list if string in name.lower()]
  File "C:\Program Files\Python37\lib\site-packages\moviepy\video\VideoClip.py", line 1197, in <listcomp>
    return [name for name in names_list if string in name.lower()]
TypeError: a bytes-like object is required, not 'str'
>>> 

这是因为‘color’参数对应取值为bytes类型导致,将其改为:TextClip.search(b'red','color')即可正确执行。

更多TextClip的介绍请参考《moviepy音视频剪辑:视频基类VideoClip子类DataVideoClip、UpdatedVideoClip、ImageClip、ColorClip、TextClip类详解》。

更多moviepy的介绍请参考《PyQt+moviepy音视频剪辑实战文章目录》或《专栏:使用PyQt开发图形界面Python应用》。

跟老猿学Python、学5G!

☞ ░ 前往老猿Python博文目录 ░

你可能感兴趣的:(老猿Python,moviepy音视频剪辑处理,python,编程语言,程序人生,TextClip)