Pergunta

I have written a python tkinter program which runs on my Raspberry Pi, which does a number of things, including interfacing with my google calendar (read only access). I can navigate to the directory it is in and run it there - it works fine.

I would like the program to start at boot-up, so I added it to the autostart file in /etc/xdg/lxsession/LXDE, as per advice from the web. However it does not start at boot. So I try running the line of code I put in that file manually, and I get this.

(code I run) python /home/blahblah/MyScript.py

WARNING: Please configure OAuth 2.0

To make this sample run you will need to download the client_secrets.json file and save it at:

/home/blahblah/client_secrets.json

The thing is, that file DOES exist. But for some reason the google code doesn't realise this when I run the script from elsewhere.

How then can I get my script to run at bootup?

Foi útil?

Solução

Figured this out now. It's tough, not knowing whether it's a Python, Linux or Google issue, but it was a Google one. I found that other people across the web have had issues with client_secrets.json as well, and the solution is to find where its location is stored in the Python code, and instead of just having the name of the file, include the path as well, like this.

CLIENT_SECRETS = '/home/blahblahblah/client_secrets.json'

Then it all works fine - calling it from another folder and it starting on startup. :)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top