2

I installed tywthon on my raspberry pi using the following command:

sudo pip install twython

There were no errors during the install. When I run my python file it comes up with:

ImportError: No module named twython

Code is as follows:

import sys
import datetime
from twython import Twython

#Twitter keys

CONSUMER_KEY="xxx"
CONSUMER_SECRET ="xxx"
ACCESS_KEY = "xxx"
ACCESS_SECRET ="xxx"

api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET)

dt=datetime.datetime.now()
mon=4-dt.month
day=18-dt.day
hr=23-dt.hour
mn=60-dt.minute
sec=60-dt.second

pythonTest("Hi, I'm using my raspberry pi and python to tweet status     updates.")
python_string=("Time until Ben's birthday: "+str(mon)+" Months, "+str(day)+" days, "+str(hr)+" hours, "+str(mn)+" minutes")

api.update_status(status=python_Test)   

I am using python 3. Not sure if that matters or not?

Mr_Benn82
  • 21
  • 1
  • 2
  • 2
    Have you tried `sudo pip3 install twython`? If you have 2.x installed, `pip` will install modules for 2.x by default. – jonrsharpe Feb 16 '15 at 13:58
  • Hi @jonrsharpe, I think that is the issue. Python 2 is installed, but when I type that line of code you mentioned into terminal I get "pip3: command not found" – Mr_Benn82 Feb 16 '15 at 14:09
  • try installing python3-pip. If on a debian based system (eg Raspbian) try `sudo apt-get install python3-pip` – Holloway Feb 16 '15 at 14:14
  • @Trengot I've done that, the line `sudo pip3 install twython` still coming up with the `pip3: command not found` issue – Mr_Benn82 Feb 16 '15 at 14:20
  • 1
    OK, I've fixed it now. Thanks for you help. The line I needed was `sudo pip-3.2 install twython` – Mr_Benn82 Feb 16 '15 at 14:23

0 Answers0