I'm developing software for Windows with Python. I am developing on Linux, and I am using Pylint to check my code. I can't get rid of the error:
F| Unable to import '_winreg'
This is obvious - Python on Linux does not have this module.
So, what do I have to put in my .pylintrc to ignore this error?
Thanks in advance, Oz
EDIT:
Documentation says:
:F0401: *Unable to import %r* Used when pylint has been unable to import a module.
Now I need to find how to use it ...
Partial solution:
pylint --disable=F0401 <filename>
I am still looking for a way to do via .pylintrc.
This may be done by adding # pylint: disable=some-message,another-one at the desired block level or at the end of the desired line of code.
you can ignore it by adding a comment in the format # pylint: disable=[problem-code] at the end of the line where [problem-code] is the value inside pylint(...) in the pylint message – for example, abstract-class-instantiated for the problem report listed above.
The solution was to include --disable=file-ignored in the Pylint command options. It took way too long to figure this out; there shouldn't be a file-ignored error when you explicitly ignore a file. More ideally, put it in a pylintrc config file, not in a command option.
You can not give a path, but only the "basename" of the directory. E.g., use --ignore=lib instead of --ignore-=appengine-toolkit/gaetk/lib . The problem is you will ignore all directories named lib .
Just run into this as well with the following code:
8: if os.name == 'nt': 9: import msvcrt 10: else: 11: import fcntl
pylint
failed the build with this error:
E: 9, 4: Unable to import 'msvcrt' (import-error)
The solution is available since pylint
0.10:
9: import msvcrt # pylint: disable=import-error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With