Using pylint with cv2 library

Hi, I am using the CV2 library to load JPEG files.

The code runs fine, but when I run pylint I get these error messages.

Can anyone explain why?

$ pylint read_jpeg.py
************* Module read_jpeg
read_jpeg.py:12:10: E1101: Module ‘cv2’ has no ‘imread’ member (no-member)
read_jpeg.py:25:15: E1101: Module ‘cv2’ has no ‘cvtColor’ member (no-member)
read_jpeg.py:25:33: E1101: Module ‘cv2’ has no ‘COLOR_BGR2GRAY’ member (no-member)
read_jpeg.py:42:0: E1101: Module ‘cv2’ has no ‘imwrite’ member (no-member)
read_jpeg.py:44:0: E1101: Module ‘cv2’ has no ‘destroyAllWindows’ member (no-member)



Hello David,

You might need to add cv2 to the extension package allow-list (Linting C extension modules is not supported out of the box because we don’t want to potentially run arbitrary code), see no-member / E1101 - Pylint 4.0.4 documentation

It could also be pylint misunderstanding cv2, it happens: GitHub · Where software is built

Hi Pierre,

Thanks for this reply, I think I understand the issue now.

As the the CV2 library is written in C pylint need a little help.

Regards,

David.