4

Having an issue when running a particular script automatically. It requires root permission, uses bluetooth, and prints in a Python Shell.

What I did:

  1. sudo nano /etc/xdg/lxsession/LXDE-pi
  2. add @python /home/pi/GUI/TSK.py
  3. ctrl+x, y, enter
  4. Restart into LXDE environment

Nothing happens. When I try this with another script that doesn't require any special permissions or use of bluetooth it works perfectly.

How can I see what's being written either in the shell or terminal?

1

When I try this with another script that doesn't require any special permissions or use of bluetooth it works perfectly.

Because LXDE session files are probably not run root. The ones in /etc perhaps could be, although since I am not so sure there is a good reason for this generally, they likely are not (even more likely: they could not be, because LXDE is not being run root). Keep in mind that most linux systems are more security conscious than Raspbian, which gives a ridiculous level of superpowers to the normal pi user (you might as well just log in as root -- but this is a discussion tangential to your question), so some of these distinctions seem strange to people who have mostly only used Raspbian.

Anyway, if they are not run root, then they won't have privileges when run by the pi user login unless they include sudo. Not this is not the case with boot scripts, which are run root. Some people confuse boot scripts with login scripts because again, on Rasbpian you have this slightly unusual case of the autologin, which if used means the login scripts are run shortly after boot automatically -- but as the autologged in user, pi.

Try starting it from a shell wrapper using sudo. You can combine this with my suggestions here about how to debug an auto-run background script.

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.