Skip to content

Video editing with Python

Fix TextClip crash when `txt` is not provided (#1201)

Renaud G7203c4e61a74
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5b2ef83..fbab857b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `IndexError` in `vfx.freeze`, `vfx.time_mirror` and `vfx.time_symmetrize` [#1124]
- Using `rotate()` with a `ColorClip` no longer crashes [#1139]
- `AudioFileClip` would not generate audio identical to the original file [#1108]
+- Fixed `TypeError` when using `filename` instead of `txt` parameter in `TextClip` [#1201]
- Several issues resulting from incorrect time values due to floating point errors [#1195], for example:
- Blank frames at the end of clips [#210]
- Sometimes getting `IndexError: list index out of range` when using `concatenate_videoclips` [#646]
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index 428a8b1f..ebd25491 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -1262,9 +1262,9 @@ class TextClip(ImageClip):
self.stroke_color = stroke_color
if remove_temp:
- if os.path.exists(tempfilename):
+ if tempfilename is not None and os.path.exists(tempfilename):
os.remove(tempfilename)
- if os.path.exists(temptxt):
+ if temptxt is not None and os.path.exists(temptxt):
os.remove(temptxt)
@staticmethod