So I've tested that my script does attempt to run and I'm recording the error message of

Traceback (most recent call last):
    File "/home/pi/steamFriendStatus_v0.3.py", line 6, in <module>
       import telepot
ImportError: No module named 'telepot'

This module works fine running the script from terminal/IDLE/Thonny and I'm declaring to use Python 3 / full Python 3 directory in the rc.local command

My rc.local file is below:

exec > /tmp/rc-local.log 2>&1

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"

/usr/bin/python3 /home/pi/steamFriendStatus_v0.3.py

exit 0
  • It might be the environment variables available to the script. If you run export from a regular shell and compare this with an export command in your rc.local (in the log file) you'll be able to see any difference, and you can fix this with export VAR=... in your rc.local file.
    – Eric Clack
    Commented Jan 22, 2018 at 11:20
  • @EricClack by environment variable are you referring to the telepot module that it is saying it cannot find?
    – Purdy
    Commented Jan 22, 2018 at 13:05

2 Answers 2


It's worth noting that rc.local is run by root, rather than the pi user which you are likely using at your terminal. It seems likely that your installation for the telepot module is installed only for the pi user, and hence when root runs the script, the module cannot be found. If this is the case, you have two options:

  • Install the telepot module globally for all users with sudo pip install telepot, then leave your rc.local unchanged.

  • Switch to the pi user in rc.local by replacing the old script line inrc.local with sudo -H -u pi /usr/bin/python3 /home/pi/steamFriendStatus_v0.3.py.

Either of the above should ensure that the telepot module is available as required.

  • Thanks, the sudo pip3 install telepot did it! Now I have some errors with my script connecting to online APIs but I'll give it some googling first
    – Purdy
    Commented Jan 22, 2018 at 15:59
  • Good to hear, @Purdy; you can mark this as accepted if you're happy with it — that's our way of saying thanks here. If you're still having trouble, feel free to link to your new question.
    – Aurora0001
    Commented Jan 22, 2018 at 16:01

I have experienced same problem with dill module.

If you already installed teleport as your pi user, and if sudo pip or pip3 install gives errors try:

sudo -H pip install teleport

this way, you can install it also for root, and it will start at rc.local

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.