I am using pygame's joystick api to use a joystick with my project on a headless system, but pygame requires a "screen" so I have setup a dummy video system to over come this. It worked fine but now all of a sudden it gives me this error:
Traceback (most recent call last):
File "compact.py", line 10, in <module>
screen = display.set_mode((1, 1))
pygame.error: Unable to open a console terminal
Here is what I have as the headless setup that is supposed to over come this issue.
from pygame import *
import os
import RPi.GPIO as GPIO
os.environ["SDL_VIDEODRIVER"] = "dummy"
screen = display.set_mode((1, 1))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…