bonzanini / Book-SocialMediaMiningPython

Companion code for the book "Mastering Social Media Mining with Python"
548 stars 264 forks source link

TWITTER_* environment variables not set #8

Closed Drewstar closed 7 years ago

Drewstar commented 7 years ago

Hi:

I am having a problem setting the twitter keys. I have went over this issue many times entering the code word for word from the book. I also tried using the code code you have that can be downloaded. From the CMD, I made sure I navigated to the book files and folder with the twitter_get_home_timeline.py and twitter_client.py files. Then I entered in my twitter keys one at a time:

set TWITTER_CONSUMER_KEY="your-consumer-key" set TWITTER_CONSUMER_SECRET="your-consumer-secret" set TWITTER_ACCESS_TOKEN="your-access-token" set TWITTER_ACCESS_TOKEN_SECRET="your-access-token-secret"

I even tried leaving in the quotes around the keys to see what would happen. But I would still get this error:

TWITTER_* environment variables not set

I am using Windows 10 Pro, actually a clean copy as of yesterday. However, I was having the problem prior to that install. Unlike the book instructions, I am not virtual environment but I would not think that would make a difference but you never know. The only thing I can think of is the problem is with Tweepy perhaps? Let me know what you think?

Thanks, Drew

bonzanini commented 7 years ago

Hi,

in Windows 10 you can also use the setx command, which sets the variables permanently, for example:

setx TWITTER_CONSUMER_KEY "your-consumer-key"

(please notice there is no "=")

After entering the command for the four values, the variables will be set permanently after reopening the command prompt. You can verify if the variable is set using:

echo %TWITTER_CONSUMER_KEY%

There are also options to set variables using the GUI, but I'm not familiar with it (a google search might help)

Drewstar commented 7 years ago

Thanks for the reply, I did get your email as well. I do know about the security issues when it comes to the Twitter Keys. I planned on deleted those keys and regenerating new ones anyway, so that is why I left those in there. I have not been able to work on the issue since I had sent you the message about it. I will be getting back to that and your book this week. Looking forward to it, thanks again for the information:)

kbspvarma commented 6 years ago

Hi Even I am having the same problem I did set the keys but while executing the code i am getting the output as TWITTER_* environment variables not set Hope to get your reply soon