1

I have a Python script which automatically runs on Startup. I created the Autostart by putting"

@lxterminal -e python3 /home/pi/digitale-werbetafel-py/main.py &

in

/etc/xdg/lxsession/LXDE-pi/autostart

I now want to handle user input with pythons input() function. Is there a way to do that? Because I can't type into the console and also nothing is getting printed to the console.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

1 Answers1

0

The way I autostart programs in Raspbian on Raspberry pi is to add the call from the .bashrc file.

/home/your_name/.bashrc

I just tried creating a one-line script with the input() function and added this line

python3 test.py

to the end of the .bashrc file

and then accessed the pi via SSH and the program executed properly and asked for my input. The same should work if booting the pi into console mode.

Mark
  • 532
  • 1
  • 4
  • 9
  • 1
    Thanks! It works perfectly combined with lxde-pi autostart to start a lxterminal on reboot! – Linus Ossmann Dec 10 '20 at 09:24
  • great! I am glad this helped. I can also make use of your information because at times I have wanted to launch my program after opening the desktop OS. If you like the answer, could you please check the -check- below the counter to the left to indicate this is the accepted answer. thanks! – Mark Dec 10 '20 at 13:55