AttributeError: module 'oauth' has no attribute 'OAuthConsumer
Upon running sample code twitter1.py and it fails on this error:
$ python3 twitter1.py
Enter Twitter Account:mytwitter
Traceback (most recent call last):
File "twitter1.py", line 20, in
any suggestions, the same error occurs if I try with oauth2
This uses the oauth.py downloaded from the code3 folder, https://py4e.com/code3/ it's possibly PyCharm has a different version, or it's common for people to install OAuth (consider the only installs in the course are an editor/Python) , while OAuth2 is different in any case.
Downloaded all the files into a new folder, a hidden.py from 2015 and it's working fine.
For future people who stumble across this issue:
The oauth library has been updated and requires to instead of
import oauth
we must
from oauth import oauth
The entire Twitter code is no longer part of this course. They broke it all so bad that it is no longer mentioned in the book - Chapter 15 is completely rewritten - https://do1.dr-chuck.com/pythonlearn/EN_us/pythonlearn.pdf
Thanks.