How to suppress a certain warning in Spyder editor?

Viewed 9203

The editor in Spyder always gives me warnings for unused imports/variables immediately after I type the line. I want to suppress such warnings. How do I do that? And I want this to happen for every file I open in the Spyder editor, wouldn't prefer local fixes.

I tried adding 'disable=' in ~/.pylintrc and it didn't work. Moreover, the Spyder editor uses pyflakes anyway.

4 Answers

You need to go to

Tools > Preferences > Editor > Code Introspection/Analysis

and deactivate the option called

Real-time code analysis

import warnings
warnings.filterwarnings("ignore")

In Spyder the linter pyflakes is used. You can write a special comment at the end of the line to ignore the line. The following comments work:

from mpl_toolkits.mplot3d import Axes3D  # noqa
from mpl_toolkits.mplot3d import Axes3D  # analysis:ignore

locate preferences -> Editor -> Code Introspection/Analysis -> Deactivate/Uncheck the Real time code analysis Warning: It will also stop showing errors in the editor

Related