Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pylint not working within Spyder

I've installed Anaconda on a Windows computer and Spyder works fine, but running pylint through the Static Code Analysis feature gives an error. Pylint was installed through Conda.

Note: Error in Spyder would not allow me to copy and paste text directly. Used a picture to text converter to get the code below so there may be a few characters off...

No config file found, using default configuration Traceback (most recent call last):
File "C: \Users\ Username \AppData \Local \Continuum \Anaconda \Scripts\pylint-script.py", line 2, in <module> 
run_pylint() 
File "C: \Users\ USERNAME \AppData \Local \Continuum \Anaconda \lib\site-packages\pylint\_init_.py", line 23, in run_pylint 
Run(sys.argv[1:]) 
File "C: \Users\ USERNAME \AppData \Local \Continuum \Anaconda \lib\site-packages\pylint\lint.py", line 1313, in _init_ 
lintercheck(args) 
File "C: \Users\ USERNAME \AppData \Local \Continuum \Anaconda \lib\site-packages\pylint\lint.py", line 729, in check 
self._do_check(files_or_modules) 
File "C: \Users\ USERNAME \AppData \Local \Continuum \Anaconda \lib\site-packages\pylint\lint.py", line 831, in _do_check 
for descr in self.expand_files(files_or_modules): 
File "C: \Users\ USERNAME \AppData \Local \Continuum \Anaconda \lib\site-packages\pylint\lint.py", line 872, in expand_files 
self.add_message(key, args=message) 
File "C: \Users\ USERNAME \AppData \Local \Continuum \Anaconda \lib\site-packages\pylint\utils.py", line 390, in add_message 
self.stats['by_moduld][self.current_name][msg_cat] += 1 
KeyError: None 

Does anyone have any thoughts on a resolution? Thank you!

like image 789
Emily K Avatar asked Jun 25 '15 15:06

Emily K


2 Answers

If you press F8 (Source> Run Static Code Analysis) this should work.

The analyse button in the pane tells it to analyse whatever file is in the Static code analysis drop down to the left of the button. If there is nothing in there it seems to get very confused.

Pressing F8 autopopulates the drop down with the current file being edited, so saves you navigating to wherever it is.

like image 125
Corvus Avatar answered Nov 11 '22 02:11

Corvus


Previously I had been clicking into the editor and then hitting "Analyze" through the Static Code Analysis feature which was producing the error above.

If instead, I clicked on the folder within the Static Code Analysis pane and browsed to the .py file, the Static Code Analysis seemed to run appropriately without an error!

Thanks!

like image 29
Emily K Avatar answered Nov 11 '22 04:11

Emily K