question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to suppress errors found by pyflakes in Spyder 4

See original GitHub issue

Problem Description

This is from a post I made at the “Spyder” Google Groups. Carlos recommended I open an issue here. The post is as follows:

I just updated to Spyder 4. Nice job developers-- many of the new features (code folding,…) are very useful.

On much of my existing code files that work fine, pyflakes now identifies errors. They appear as red circles in the left margin of the editor. The error message is “Undefined name 'funcname” (pyflakes E)". The errors are because the imports of functions “funcname” are done in an exec statement; I know, I know, using exec like this isn’t good form, but I do have my reasons, and this post is about pyflakes more generally than just this specific type of error.

Here are my questions:

  • In the past, other linters or code analysis tools have similarly flagged these same lines for errors, for the same reason. I have been suppressing those error notifications/messages successfully by adding " # analysis:ignore " to the end of the line. Is there a similar way to suppress the pyflakes errors (" # analysis:ignore " does not work)? This sort of solution is really what I need, otherwise I will want to turn pyflakes off. I tried " # NOQA" but it apparently doesn’t work. I did some searching around for info on this but came up empty.

  • Is there a pyflakes config file somewhere, in which I can suppress this particular error wherever it occurs?

  • Is there a way to just turn pyflakes off? I could not find it in Preferences.

Secondary question:

  • When I hover my mouse over the red circle, a pop-up box appears, not adjacent to the red circle but some distance away to the right, showing the error message. The pop-up also has a red X in the corner as if I could click it to suppress the error. As soon as I move my mouse off the red circle, towards pop-up in order to attempt to click the red X, the pop-up disappears (because it is not directly adjacent to the red circle in the left margin). So… I can never actually get my mouse over the red X. Is this the intended behavior? Is the red X meant to enable clicking to suppress the error, or not? Only curious about this; these are such common errors that I doubt I would ever click each pop-up.

## Versions
Python 3.6.7 64-bit | Qt 5.9.7 | PyQt5 5.9.2 | Windows 10 

* Spyder version:      4
* Python version:      3.6.7
* Operating System name/version:   Windows 10

About my Qt, PyQt, and dependencies, I already rolled back to Spyder 3 so in order to get them for Spyder 4 I will need to reestablish a new conda env; if this is truly necessary I can do it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
ccordoba12commented, Jun 24, 2021

Sorry for the long time it took us to fix this. It’ll be available since our 5.1.0 version, to be released at the end of July.

Please see PR #15927 for the inline comments we will support on that version to skip linting messages.

3reactions
ccordoba12commented, Jul 21, 2020

if pylint was an option it might be worth considering too

We’re also considering to add support for Pylint, but as an advanced linter because it usually requires a config file to be usable (it lints way too many stuff).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re: [spyder] how to suppress errors found by pyflakes (or turn ...
I have been suppressing those error notifications/messages successfully by adding " # analysis:ignore " to the end of the line. Is there a...
Read more >
Disable linting in Spyder (orange triangles from Pyflakes)
With the new Spyder version 5.3.3, the following methods are now available in order to suppress the orange warning triangles: Append either #...
Read more >
Code Analysis - Spyder 5
Cancel analyzing a file with the Stop button, and if analysis fails, click the Output button to find out why. If Pylint does...
Read more >
Working with Spyder — Spyder 5 documentation
Running the analysis again will show us that the error is no longer visible. If we want to silence a message in the...
Read more >
Selecting and Ignoring Violations — flake8 6.0.0 documentation
Selecting and Ignoring Violations¶. It is possible to select and ignore certain violations reported by Flake8 and the plugins we've installed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found