findContours and drawContours errors in opencv 3 beta/python

I try to run an example from here. import numpy as np import cv2 img = cv2.imread('final.jpg') imgray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret,thresh = cv2.threshold(imgray,127,255,0) contours,