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
Pygame is trying to open a console which means you're running this script through ssh or cron or somewhere else that doesn't have access to the console. I would try skipping set_mode (since the dummy driver likely doesn't have modes to set) and just try to initialize the display. You can try running it as root which might give it access. You can also try telling it to use fbcon.
os.putenv('SDL_VIDEODRIVER', 'fbcon')
pygame.display.init()