As the title suggests, I'm trying to launch RetroPie from a Pygame script. I'm using a 2.8" PiTFT from Adafruit.

In order to launch EmulationStation on the PiTFT, I'm using fbcp. In order to display Pygame on the TFT, I'm using this code in my main script:

os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"

After doing so, I simply run:


From within my main Pygame script, I call another script which uninitializes Pygame, and runs fbcp and EmulationStation like so:

subprocess.Popen(shlex.split("sudo -u pi 'emulationstation'"))

Here's the thing, though; when run from my main Pygame script, EmulationStation works as normal, however, when I try to launch an emulator, RetroPie returns the following error:

/opt/retropie/supplementary/runcommand/runcommand.sh: line 666: /dev/tty: No such device or address
/opt/retropie/supplementary/runcommand/runcommand.sh: line 695: /dev/tty: No such device or address

...and just returns to EmulationStation.

However, when I run the subscript directly, the emulator works as normal.

Last I checked, /dev/tty was a file, and did exist. What does this error mean? Is it something with my modification of the environment variables? Or is Pygame just being problematic? How would I go about fixing this?

UPDATE: Deleting the environment variables seemed to have no effect on the script. I deleted the environment variables like so:


...but the script still wouldn't launch the emulator. It raises the same error. When Pygame launches, how does it affect the system? Is anything significant altered?


I fixed the problem by editing runcommand.sh in /opt/retropie/supplementary/runcommand. By editing line 666 and 695 to reference /dev/tty1 as opposed to /dev/tty, which it does by default, emulationStation will launch the emulator as normal.

  • Not working here. Changed from line 808: /dev/tty: No such device or address to Unable to open /dev/tty – alanjds Aug 2 '16 at 4:51
  • What lines did you alter? Same as above? – laxex Aug 5 '16 at 16:48
  • Mine came with different lines, as the repo is constantly updated. Changed the 1st error and it chocked. Changed the 2nd error and it opened, but no keypresses got recognized. Then I give up and installed the full-blown image instead of poking over my Volumio image installation. – alanjds Aug 5 '16 at 20:43
  • I see. Did you try replacing all references to /dev/tty with /dev/ttyX within runcommand.sh, with X being a different number? – laxex Aug 8 '16 at 16:13
  • Yes. Then the emulators stopped to open. – alanjds Aug 8 '16 at 22:31

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.