Run python script in CE

I tried this code with /dev/tty0 but only spash screen occured without script output. I also tried /dev/fb0 instead /dev/tty0 but unsuccessfully.

Seems the output from the script is really not shown and don’t know why not.

I was testing this for another user with dialog (display dialog boxes from shell scripts) and it worked - dialog was shown on TV and can be controlled with keyboard.

Please clarify about dialog - you meant the name of some library?

Maybe it’s possible to use a new created systemd unit for running my python script as service? I run successfully this systemd auth.service:

[Unit]
Description=Auth service
After=network-online.target 
Conflicts=getty@tty1.service

[Service]
Type=simple
WorkingDirectory=/storage/bin/
ExecStart=/opt/bin/python3 /storage/bin/auth.py 
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit

[Install]
WantedBy=multi-user.target

# systemctl status auth.service
� auth.service - Auth service
   Loaded: loaded (/storage/.config/system.d/auth.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-03-07 15:11:33 EET; 2s ago
 Main PID: 2977 (python3)
   Memory: 13.6M
   CGroup: /system.slice/auth.service
           ��2977 /opt/bin/python3 /storage/bin/auth.py

Mar 07 15:11:33 node-9 systemd[1]: Started Auth service.

but still not available username prompt on TV screen unfortunately…

Why not just write real Kodi addon which works and have remote control support?

Btw: The above code with dialog doesn’t work anymore for me.

because for me it’s more complicated task than using my almost ready python script. I never wrote a Kodi addon earlier. A good news - I successfully run recently systemd service running a bash script contained command of running my python script and I saw Username prompt on my TV screen. I.e.

# cat .config/system.d/authen.service 
[Unit]
Description=Auth service
After=network-online.target multi-user.target
Conflicts=getty@tty1.service

[Service]
Type=simple
WorkingDirectory=/storage/bin/
ExecStart=/bin/bash /storage/bin/authen.sh 
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit

[Install]
WantedBy=multi-user.target

and

#!/bin/bash
sleep 20
echo 1 > /sys/class/vtconsole/vtcon1/bind
/opt/bin/python3 /storage/bin/auth.py > /dev/tty0 < /dev/tty0

Here uses only command of attaching framebuffer console from console layer

echo 1 > /sys/class/vtconsole/vtcon1/bind

without following detach command but unfortunately after reboot of tvbox Username prompt did not occured. Maybe something is wrong with authen.service systemd unit file or need to play with sleep value in bash script…

I can totally understand that you would like to make it as easy as possible but afaik this won’t work.
Lemme ask this, is it really that security critical that you can’t just save the password in CE?

yes, in my case security is important and I can’t just save password in CE.

Is it save to input it then through kodi?
You could also use your phone to ssh into CE then run the script and input password from phone. Just an idea.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.