I want to create a Python program opening webcam with OpenCV and controlling Bluetooth device with gattlib on Raspberry Pi. Here is the code:
import cv2
import threading
from gattlib import GATTRequester
from time import sleep
cap = cv2.VideoCapture(0)
cap.set(3, 320)
cap.set(4, 240)
while(True):
    print(1)
    ret, frame = cap.read()
    print(2)
    cv2.imshow('frame', frame)
    print(3)
    key = cv2.waitKey(1) & 0xFF
    print(4)
    if key == ord('q'):
        break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
The weird thing is it will block the thread at key = cv2.waitKey(1) & 0xFF.
If I delete from gattlib import GATTRequester, the code can work well. 
Does anybody know what is going on here?
Thanks!
