E
E
Elvis2019-05-17 16:48:27
Python
Elvis, 2019-05-17 16:48:27

Why is there an error when running the script?

There is an application - let it be a simple echo bot for a cart.
threw on the server in a virtual environment. I launch from the console - everything perfectly works. I configure systemd - it does not start.
I dug into the logs and found that it does not start because it does not find the certificate file for the webhook. All files are nearby.
I conducted experiments, as a result:
1) if you go to the folder with the script and start the virtual environment first, and then "python app.py" - it works
2) if you go to the folder with the script and run the command "bin / python app.py" - works
3) if you go to the folder above and run the command "bot/bin/python bot/app.py" - it does not start, it does not find the certificate file specified in the script.
Exactly the same thing happens with systemd.

ExecStart=/home/me/venvs/bot/bin/python /home/me/venvs/bot/app.py

I realized that the script is being launched from another folder - that's why the file cannot be found.
I tried to specify the cert file in the script as "crt.pem" and as "os.path.abspath('cert.prm')" - still does not want to start.
Actually the question is how to work with files, if the launch occurs from where?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tsarevfs, 2019-05-17
@Dr_Elvis

Try setting working directory https://unix.stackexchange.com/a/200657

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question