Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylance Error: Unknown Member ‘FuncAnimation’ in FuncAnimation Class #21

Closed
patmejia opened this issue Jul 10, 2023 · 2 comments
Closed

Comments

@patmejia
Copy link
Owner

Pylance error: ‘FuncAnimation’ member unknown in ‘FuncAnimation’ class.

Cannot access member "FuncAnimation" for type "FuncAnimation"
  Member "FuncAnimation" is unknownPylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)
(class) FuncAnimation
 [See Real World Examples From GitHub](vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
@patmejia
Copy link
Owner Author

patmejia commented Jul 10, 2023

Debugging:

Checked if the FuncAnimation class can be imported by running the command:

python -c "from matplotlib.animation import FuncAnimation; print(FuncAnimation)"

Console output:

(contrail_env) ➜  contrails-vision git:(contrail-animation) ✗ python -c "from matplotlib.animation import FuncAnimation; print(FuncAnimation)"

<class 'matplotlib.animation.FuncAnimation'>

Conclusion: The FuncAnimation class was successfully imported from the matplotlib.animation module.

References:

https://stackoverflow.com/questions/62314639/trouble-with-loading-funcanimation-from-matplotlib-animation
https://stackoverflow.com/questions/70867679/can-pylance-handle-with-new-members-in-inherited-classes
microsoft/pylance-release#2198
matplotlib/matplotlib#5314
https://stackoverflow.com/questions/36546991/get-error-when-importing-funcanimation-from-matplotlib-animation
https://stackoverflow.com/questions/70867679/can-pylance-handle-with-new-members-in-inherited-classes

@patmejia
Copy link
Owner Author

Solution:

Issue with accessing the FuncAnimation class from the matplotlib.animation module: one possible solution is to change how you're importing the class.

Instead of using the following import statement:

from matplotlib import animation

Try using this import statement instead:

from matplotlib.animation import FuncAnimation

This will directly import the FuncAnimation class from the matplotlib.animation module, which might resolve the issue.

Examples:

https://github.com/patmejia/contrails-vision/blob/main/src/utils/contrail_animation.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant