pylint #9837 syntax error in a submodule mistakenly reported as "No name 'a' in module 'module_a'" [resolved]

Pascal Meunier reported...

files hierarchy


from module_a.a import my_class contains a syntax error.

$ pylint module_a/
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 inside the directory "module_a" or some problem with the filesystem or the names... The problem was quite different (a syntax error in 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.

appeared in<not specified>
done in0.18.1
load left0.000
closed by<not specified>