简体   繁体   中英

How to run PyQt app on Raspberry pi startup?

I want to run a python file containing GUI made on PyQt5 when the raspberry pi starts. I can run the file from terminal without any problems but it is a manual procedure. I tried following this post: PyQt: How to run GUI on Raspberry Pi desktop startup? but had no progress. My app won't start on raspberry pi startup.

Please note:

  • I have enabled auto login to Desktop.
  • PyQt5 is installed correctly.
  • I am able to run python script with terminal and the app opens fine.

Thanks,

Gurpreet

I solved it by making a new python file. I ran this line: os.getcwd() which showed me the current directory in which program was running.

I found out that even thought my python file was placed in the /home/pi/Desktop directory, the program executed in the /home/pi directory and hence was searching for other files in the same directory.

So I moved all the program related files to the /home/pi directory and it started working as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM