How to configure Raspberry Pi to run only one Python application?

Asked

Viewed 544 times

-1

I am developing an application in Python to run on a Raspberry Pi, this application will start as soon as the device is turned on. I am using the Pyqt5 to make the screens.

  • How can I configure the Raspberry Pi for that purpose?
  • It is possible to install only the Raspbian Stretch Lite or I have to install the Raspbian Stretch with desktop so that the screens are displayed?
  • I recommend seeking the next questions about the Raspberry Pi on own community and deal only with things pertaining to programming here.

  • Thank you, I was not aware of the existence of this community. I must remove this question?

  • I don’t think so. It’s just that there are people who mess with it and will give you more complete, fast and accurate answers. That’s if you’re not in the forum anymore.

1 answer

2

How can I set up Raspberry Pi for this purpose?

An easy way to do this setup is to put a command to run your file .py in /etc/network/if-up.d/upstart. You need to open the file:

sudo nano /etc/network/if-up.d/upstart

And then look for the part all_interfaces_up() and add the path to your file:

all_interfaces_up() {
python /caminho/para/seu/arquivo.py # adicionar essa linha aqui
# vai ter mais coisa escrita aqui    
}

There’s other ways to run an application once Python starts. You can choose the one that best suits you.

It is possible to install only the Raspbian Stretch Lite or I have to install the Raspbian Stretch with desktop so that the screens are displayed?

It is possible only in the Lite version.

  • It didn’t work, I’ll research more and post here again.

  • Look for solution with systemd. It has in the link I recommended. When I needed and had problems, I used it and it worked.

  • I added the lines in /etc/rc.local to run my python script. It tries to run but gives error "Qxcbconnection: Could not connect to display". What can be?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.