PyQt4 or PyQt5 from framebuffer without X server - python

I'm trying to run a PyQt gui application from console on a Raspberry Pi 3.
Withough X11 server.
I tried xvfb-run python test.py but it did not work.
In the case of PyQt4, it outputs
"python: Fatal IO error 11 (Resource temporarily unavailable) on X server :99."
When I terminate the process.
In the case of PyQt5, it outputs
"libEGL warning: DRI2: failed to create any config
Cant find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Unsupported screen depth: 8"
and then throws this when I kill the process
"The X11 connection broke (error 1). Did the X11 server die?"
I'm running raspian jessie
Any idea how to get this working ?

Related

PiCamera out of resources no matter what

I started trying the official test code;
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(5)
camera.stop_preview()
And I got this error;
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources
This is immediately after a reboot, no running scripts or processes, camera verified enabled in raspi-config via terminal and the Raspberry Pi Configuration app, and GPU memory increased to 256. I know the camera works because I can use the RPi Cam Web Interface and see the camera feed just fine (I uninstalled it afterwards to see if it was conflicting, which it apparently wasn't.) I've already updated and upgraded, and I can't run rpi_update even if I wanted to because it says "Invalid git hash specified" when I type "y" to proceed. I've reached the limit of troubleshooting, and reddit deletes my post instantly because the bot says I didn't research.
From the command prompt, I did some basic troubleshooting at the basic level. Copied directly from the console:
pi#raspberrypi:~ $ vcgencmd get_camera
supported=1 detected=1
pi#raspberrypi:~ $ raspistill -o image.jpg
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
pi#raspberrypi:~ $

Problem with X DISPLAY when open3d draw geometry used

I get the following error:
[1;33m[Open3D WARNING] GLFW Error: X11: Failed to open display :0.0[0;m
[1;33m[Open3D WARNING] Failed to initialize GLFW[0;m
[1;33m[Open3D WARNING] [DrawGeometries] Failed creating OpenGL window.[0;m
I have tried using open3d and when I try to get a 3d mesh, I get the above mentioned error. I tried using Xming with X11 enabled and giving IP address of Linux environment in cluster where the code is written and using putty I tried export display=(Linux IP address):(port number) in terminal after connecting to SSH through putty. It didn't work. How can I resolve this error to get the display active ?

PyVisa - Cannot connect via VICP but TCPIP works?

I am having an issue connect to a LeCroy oscilloscope using PyVisa v1.9.
If I trying to connect using the code:
import visa
from pyvisa.resources import MessageBasedResource
visa.log_to_screen()
rm = visa.ResourceManager()
my_instrument = rm.open_resource('VICP::10.2.72.141:INSTR', resource_pyclass=MessageBasedResource)
I get the error: VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.
However, if I change to:
my_instrument = rm.open_resource('TCPIP::10.2.72.141:INSTR', resource_pyclass=MessageBasedResource)
The code with connect with the instrument, but the functions in my driver no longer work. Read commands also respond with:
‘WARNING : CURRENT REMOTE CONTROL INTERFACE IS TCPIP’
I never saw an issue before moving to version 1.9 of pyvisa.
Python version is 2.7 64-bit, running on windows 10 64bit
Any hints would be appreciated.

Pygame.display.init() error: "No available video device", on VPS Server

I'm trying to run a pygame script on a vps server, and I'm receiving an error on the pygame.display.init().
Following the directions found here http://www.pygame.org/docs/ref/display.html#pygame.display.init and in other sources, I used all this configurations before the init():
os.environ["​​SDL_VIDEODRIVER"]="dummy"
os.environ["SDL_VIDEODRIVER"]="x11"
os.environ["SDL_VIDEODRIVER"]="dga"
os.environ["SDL_VIDEODRIVER"]="fbcon"
os.environ["SDL_VIDEODRIVER"]="directfb"
os.environ["SDL_VIDEODRIVER"]="ggi"
os.environ["SDL_VIDEODRIVER"]="vgl"
os.environ["SDL_VIDEODRIVER"]="svgalib"
os.environ["SDL_VIDEODRIVER"]="aalib"
So, the "dummy" option causes the script to go into a loop. Any other option give me the error:
<class 'pygame.error'>: No available video device
I have x11 installed. I'm calling the python script from a php file, so, I would expect the graphic output to go inside the browser, or, the "video device" to be set automatically as the user browser. Not happening.
Are you ssh'd into the vps server? Have you tried x forwarding, ssh -X user#server.com then when you run the script from the command line it should open on your window

Injecting uinput keypresses

I have Arch Linux ARM running on a Raspberry Pi. On boot, an X application is started (navit).
After system is booted, I ssh into it, and try the following python code:
from evdev import UInput, ecodes
inp = UInput()
inp.write(ecodes.EV_KEY, ecodes.KEY_UP, 1)
inp.write(ecode.EV_KEY, ecodes.KEY_UP, 0)
inp.syn()
The problem- the application which is started on boot does not receive this keypress.
The following does work from ssh session- application receives arrow up keypress.
DISPLAY=:0 xdotool key Up
uinput kernel module is loaded, Xorg configuration is left at defaults (hotplugging devices should be enabled- although, I cannot verify it).
dmesg shows that input device is registered:
[ 28.725976] input: py-evdev-uinput as /devices/virtual/input/input0
I alsso verified that the application I started is currently focused, by using:
DISPLAY=:0 xdotool getwindowfocus getwindowpid
Any ideas where to look next to debug this issue?
Turns out evdev module was not loaded. I though loading uinput module should suffice, but it's not.
I discovered it by noticing that the code did work when external keyboard was plugged in.

Categories