2

The Twilio python quickstart guide says to use a submodule called twilio.rest .

But after installing the twilio module today via sudo pip install twilio, which installed version 2.0.8, there appears to be no module (or object) called "rest" within the twilio module.

Where is twilio.rest?

AlcubierreDrive
  • 3,654
  • 2
  • 29
  • 45
  • By the way, here is the twilio module's github, which also says to use twilio.rest https://github.com/twilio/twilio-python – AlcubierreDrive Jan 04 '12 at 05:52
  • Aha! That fixed it. Thanks! Yes, ten minutes before doing the pip install, I had used port to install 2.0.8 (the latest version with a Portfile), but I then uninstalled it, and figured that once uninstalled it wouldn't affect pip. Textbook example of spooky action at a distance, haha – AlcubierreDrive Jan 04 '12 at 08:06

2 Answers2

4

There are two things you should check.

First, if you already have a package installed with pip, running pip install package-name will NOT upgrade the package. To upgrade the package to the newest version, run

pip install --upgrade twilio

Second, we often see this error occur because people named the file containing their Twilio code twilio.py. This means that trying to import twilio.rest will fail because Python is looking in the twilio.py file for the .rest module. To resolve the problem use a different filename.

If you have more problems with the twilio module and ImportError messages, there is a full set of documentation here: http://readthedocs.org/docs/twilio-python/en/latest/faq.html#importerror-messages

Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
1

I had the same symptom but my problem was I named my view handler twilio.py. That caused a conflict with twilio library. Just name your py file something else like phone.py.

David Dehghan
  • 22,159
  • 10
  • 107
  • 95