Spyder: Static Code Analysis can be attempted without selected file

Created on 24 Feb 2019  路  5Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [x] Searched the issues page for similar reports
  • [x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [ ] Could not reproduce inside jupyter qtconsole (if console-related)
  • [x] Tried basic troubleshooting (if a bug/error)

    • [x] Restarted Spyder

    • [ ] Reset preferences with spyder --reset

    • [ ] Reinstalled the latest version of Anaconda

    • [x] Tried the other applicable steps from the Troubleshooting Guide

  • [x] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

Static code analysis can be attempted when no file is selected and causes an internal error.

What steps reproduce the problem?

  1. Delete pylint.results in spyder-py3, start spyder, run a Static Code Analysis on a file
  2. rename, move or delete the file (which should be the only one listed in the path dropdown)
  3. open an existing .py file in spyder.
  4. restart spyder. The path field in the analysis tab is now cleared but the Analyse Button is now active
  5. click it

What is the expected output? What do you see instead?

The button should not be active. Clicking it should have no effect

Paste Traceback/Error Below (if applicable)

Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/__main__.py", line 7, in <module>
    pylint.run_pylint()
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/__init__.py", line 19, in run_pylint
    Run(sys.argv[1:])
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/lint.py", line 1394, in __init__
    linter.check(args)
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/lint.py", line 801, in check
    self._do_check(files_or_modules)
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/lint.py", line 920, in _do_check
    for descr in self.expand_files(files_or_modules):
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/lint.py", line 959, in expand_files
    self.add_message(key, args=message)
  File "/home/leo/.local/lib/python3.6/site-packages/pylint/utils.py", line 449, in add_message
    self.stats['by_module'][self.current_name][msg_cat] += 1
KeyError: None

Versions

  • Spyder version: 3.3.3
  • Python version: 3.6.8
  • Qt version: -
  • PyQt version: -
  • Operating System name/version: Fedora 28 64-Bit

Dependencies

IPython >=4.0     :  6.4.0 (OK)
cython >=0.21     :  None (NOK)
jedi >=0.9.0      :  0.12.1 (OK)
matplotlib >=2.0.0:  2.2.3 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
numpy >=1.7       :  1.14.5 (OK)
pandas >=0.13.1   :  0.22.0 (OK)
psutil >=0.3      :  5.4.3 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pyflakes >=0.6.0  :  1.6.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
pylint >=0.25     :  1.7.5 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.7.5 (OK)
sympy >=0.7.3     :  None (NOK)
Pylint Bug

All 5 comments

Thanks for reporting. We'll fix this in our next version.

@definite-purple By "no selected file", do you mean no files open the Editor? Pretty much every command breaks in that instances rather than disabling itself; I thought our approach was just to ensure there is always an open file in the Editor by opening a new untitledN one if the user closes everything.

No. I'm referring to the static code analysis tab, which has a file select dropdown entry field thing, and I meant that no file path is shown in there.
At least one code file (after step one potentially a new untitled one) is always open int the editor pane when reproducing the error

Thanks for clarifying!

@dalthviz, please take a look at this one.

Was this page helpful?
0 / 5 - 0 ratings