0

I'm using Django and when pushing to Heroku I'm finding the 'module' object has no attribute 'Api' error. I'm aware of the error - the twitter.__file__ points to the twitter.pyc instead of the twitter.py. When the .pyc doesn't exist the .py is found first, however, it still doesn't work when I run the code.

Not sure how I should continue - Should I try:

  1. to ignore the .pyc using imp.load_module,
  2. symlink
  3. Use another much better solution :-)

Finding this python-twitter integration a little frustrating as I was using Tweepy perfectly until last week when it stopped working.

Would really appreciate the help

codeape
  • 97,830
  • 24
  • 159
  • 188
  • Full exception traceback, please. – codeape Jun 18 '13 at 12:06
  • I'm getting 'module' object has no attribute 'Api'. api = twitter.Api(consumer_key, consumer_secret, access_token_key, access_token_secret). Sorry, not sure what else to include on traceback. – Milkman777 Jun 18 '13 at 12:08
  • Could you post the contents of your twitter.py file in a gist/pastebin or similar? Also when you push to Heroku make sure you do not push any *.pyc files. – codeape Jun 18 '13 at 12:14
  • Ok thanks - My twitter.py -https://gist.github.com/anonymous/d1273014fcae95c189c6. – Milkman777 Jun 18 '13 at 12:23
  • And in your code (probably at the top) I assume you have a ``import twitter`` statement? My best guess at the moment is that you somehow import the wrong twitter.py file. Make sure that your directory structure contains exactly one twitter.py file and that it is in the correct place (ie. somewhere on PYTHONPATH). – codeape Jun 18 '13 at 13:08
  • Yes, I had included import twitter and I made sure I had imported the right file, however, I was unable to solve the problem. I decided to use another twitter wrapper instead. Thanks codeape for your help :-) – Milkman777 Jun 19 '13 at 09:16

0 Answers0