nothing works, gets "NameError: name 'func' is not defined"
See original GitHub issueAny command fails with same error, I tried different examples and different files, as well as uninstalling and reinstalling moviepy and decorator, nothing worked. VideoFileClip is created and can be accessed, but it fails when methods are called. See below a minimalistic example from frame extraction example:
Expected Behavior
Extract a frame (or equivalent command to perform any operation on file).
Actual Behavior
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
d:\dati\ordine\programmazione\youtube\pytube.ipynb Cell 29' in <cell line: 1>()
----> [1](vscode-notebook-cell:/d%3A/dati/ordine/programmazione/youtube/pytube.ipynb#ch0000036?line=0) video.save_frame('prova.jpg')
File ~\anaconda3\envs\youtube\lib\site-packages\decorator.py:232, in decorate.<locals>.fun(*args, **kw)
[230](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/decorator.py?line=229) if not kwsyntax:
[231](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/decorator.py?line=230) args, kw = fix(args, kw, sig)
--> [232](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/decorator.py?line=231) return caller(func, *(extras + args), **kw)
File ~\anaconda3\envs\youtube\lib\site-packages\moviepy\decorators.py:79, in preprocess_args.<locals>.wrapper(f, *a, **kw)
[78](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/moviepy/decorators.py?line=77) def wrapper(f, *a, **kw):
---> [79](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/moviepy/decorators.py?line=78) names = inspect.getfullargspec(func).args
[80](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/moviepy/decorators.py?line=79) new_a = [fun(arg) if (name in varnames) else arg
[81](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/moviepy/decorators.py?line=80) for (arg, name) in zip(a, names)]
[82](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/moviepy/decorators.py?line=81) new_kw = {k: fun(v) if k in varnames else v
[83](file:///c%3A/Users/kovor/anaconda3/envs/youtube/lib/site-packages/moviepy/decorators.py?line=82) for (k,v) in kw.items()}
NameError: name 'func' is not defined
Steps to Reproduce the Problem
from moviepy import *
from moviepy.editor import AudioFileClip, VideoFileClip
video = VideoFileClip(r"D:\dati\ordine\programmazione\youtube\salmon.mp4")
video.save_frame('prova.jpg') #this fails with error shown above
Specifications
- Python Version: Python 3.10.4
- Moviepy Version: 1.0.3
- Platform Name: Windows 10 Home
- Platform Version: 10.0.19043 Build 19043
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Python NameError: name is not defined - Stack Overflow
The solution to this problem is to invoke your classes and functions after you define them. Python does not have any way to...
Read more >NameError: function is not defined in Python | bobbyhadz
The Python NameError: function is not defined occurs when we try to call a function that is not declared or before it is...
Read more >NameError: name 'Y' is not defined (and other infuriating tales)
I tried it with raw_input, but then I get the “Oops, try again! No need for the raw_input() function in this exercise!” message....
Read more >User Defined Functions - Python 3 Notes
In Python, defining the function works as follows. def is the keyword for defining a function. The function name is followed by parameter(s)...
Read more >How to fix Name Not Defined Error in Python - YouTube
This video will explain how to solve the 'something' is not defined error in Python.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t know if this was really what solved the issue, because it was a delayed effect at restart and it was not the only thing I had tried, but maybe it was removing and reinstalling, as indicated at the end of this thread: https://github.com/Zulko/moviepy/issues/1625#issuecomment-973056577
I’m closing this for now as OP solved their problem but we don’t know what the fix (or actual issue) was, so there’s nothing to go on with regard to labelling the issue.