Reputation: 607
I have a short python script that will open the webcam and display a live feed on a local web site. I am using PyCharm IDE which offers corrections and notify's you in case of syntax error. When I pass an argument to VideoCapture it highlights it and says 'unexpected argument'.
self.video = cv2.VideoCapture(0)
This is in a class and the 'unexpected argument is caused by the 0 that is passed to the OpenCV function. Is there any way I can fix this?
By the way it works fine as is - when you run it, it works the way it should. If you remove the zero the error goes away but it no longer initializes the webcam.
Upvotes: 4
Views: 2506
Reputation: 877
Instead of hacking in the incorrect bindings, you could also just silence the warning in the IDE, by adding a noinspection comment.
# noinspection PyArgumentList
cap = cv2.VideoCapture(filename)
Upvotes: 2
Reputation: 2901
I think you are right and Hector-the-Inspector of PyCharm IDE is wrong. So go to the line with warning and suppress the warning for this statement: put cursor on the statement, go to the bulb icon, click on triangle in the right corner, in the menu choose "Suppress for statement".
Upvotes: 1