0

I have set up a service, and when I run it, I get the following error:

 ImportError: No module named httplib2

I have httplib2 installed with pip and my systemd ExecStart command is like this:

ExecStart=/usr/bin/python /home/orionas/Desktop/quickstart.py

The same script runs perfect from command line.

2 Answers 2

2

Hmm, I think you probably have installed httplib2 under your user but systemd uses another user to run the quickstart script.

Sign up to request clarification or add additional context in comments.

Comments

0

Under [Service] include a line "User=" The python script will then inherit the permissions and paths of that user AFAIK.

Note: It is probably Not recommended to run a systemd service with userid the same as yours. Potential security risk. Another possible solution would be to run the python script within a [virtualenv] http://docs.python-guide.org/en/latest/dev/virtualenvs/ Many people do this and as far as I know it's the recommended practise

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.