pylint #9837 syntax error in a submodule mistakenly reported as "No name 'a' in module 'module_a'" [resolved]
Pascal Meunier reported...
-module_a \-a.py -b.py -__init__.py
from module_a.a import my_class
a.py contains a syntax error.
$ pylint module_a/b.py No config file found, using default configuration ************* Module module_a.b C: 1: Missing docstring E: 1: No name 'a' in module 'module_a' W: 1: Unused import my_class
Which I took to mean that there was no file a.py inside the directory "module_a" or some problem with the filesystem or the names... The problem was quite different (a syntax error in a.py). The Python error message is just as misleading. I was scrambling for quite a while trying to find out what was wrong in the filesystem or the names I had given to the files.
I think that a Python syntax error inside a file should generate something more appropriate and helpful than something that sounds like the claim that there is no such file! I understand now that the syntax error prevented the name from appearing in the namespace, so from that oblique point of view the error message is correct. However, why on earth not report syntax errors as such? I found no option to increase the verbosity of PyLint.
|closed by||<not specified>|