I am attemping to create the pan-tilt face tracker, using

  • Raspberry Pi 2
  • Raspian
  • Regular Raspberry Pi Camera

from an article on the Pimoroni site, and when I run the python code I get about 20 lines of

VIDIOC_QUERYMENU: Invalid argument

and ends with

(Video:3418) : Gtk-WARNING **: cannot open display

I honestly have no idea how to diagnose this at all


After some helpful info in the comments I ran it under vnc and now a video windows pops up - however the

VIDIOC_QUERYMENU: Invalid argument

error is still there, and a new error message of

Xlib: extension "RANDR" missing on display ":1.0" 


There is still no servo movement.

-------------UPDATE---------------------- I am connecting using either Putty or TightVNC - I do not have the option of connecting a monitor to the pi at the moment

  • And you are running this from within an X session? – Werner Kvalem Vesterås Jun 10 '15 at 14:24
  • @WernerKvalemVesterås I'm using Putty (windows SSH) - should I have it hooked up to a monitor or remote in through VNC? – Steve French Jun 10 '15 at 14:39
  • It may not solve the first error but that's definitely the issue with the second one. Gtk is a GUI toolkit. If you have a display connected with X running, you'll have to have to provide the display id (see here). That is probably a little more foolproof than VNC, at least until you know it is working. – goldilocks Jun 10 '15 at 14:44
  • Progress! I tried it under vnc/LX Termainal, and while I still get the VIDIOC_QUERYMENU: Invalid argument warning, - instead of the (Video:3418) : Gtk-WARNING **: cannot open display error I get, well, see the updated question.... – Steve French Jun 10 '15 at 14:57
  • What happens if you put DISPLAY=:0 before the command, like DISPLAY=:0 python -m module.tool as well as make sure you do not have XForwarding enabled? – earthmeLon Jun 16 '15 at 4:41

Check echo $DISPLAY what is it showing? is it showing the correct display?

Note before this try to be in x session Do, startx for starting x server, open Lxterminal and please post the output of echo $DISPLAY

it should show :0 as output. else try export DISPLAY=":0"

and then run your program/application from lxterminal.


So - it would seem that the open cv program doesn't work in either a shell or TightVNC - but it does work in a different vnc program - Ultra VNC in my case. I reloaded the code and everything works great.


close the putty and work on vnc terminal work on one of them only

  • 1
    Hello and welcome. Could you please explain how this is supposed to be relevant to the question? – Ghanima Jul 29 '16 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.