Python: USBCamera does not work?

Hi! We ran into a problem when trying to set up a USBCamera with RobotPy and Python. This code gives us an error:


We get a module has no attribute to USBCamera and CameraServer error. I tried importing wpilib._impl but that didn’t help anything. Thanks a bunch in advance!

I had the same problem and it took quite a while to figure out.

   = wpilib.USBCamera()
            self.camServ = wpilib.CameraServer()
   = None

So you create a camera object, start it, then start the camera server. The try/except is in case you want to test without the camera, and it won’t break.