I tried your code but no chance, the program stops at cam.takePicture();. There is no response from the camera. May be I have the wrong camera: I should have the TTL-camera, the backside looks like the attached picture.
cam.takePicture();
Thanks Pascal