rhiever / TwitterFollowBot

A Python bot that automates several actions on Twitter, such as following users and favoriting tweets.
GNU General Public License v3.0
1.31k stars 447 forks source link

No such file or directory: 'config.txt' #46

Closed premierball23 closed 9 years ago

premierball23 commented 9 years ago

How do I fix this error? I have the config.txt file in the TwitterFollowBot folder within this directory anaconda>lib>site>site-packages>TwitterFollowBot.

I have already appended this directory into python.

I'm just following the code

from TwitterFollowBot import TwitterBot my_bot = TwitterBot()

rhiever commented 9 years ago

Place config.txt wherever you want and pass the path to the TwitterBot constructor, e.g.,

from TwitterFollowBot import TwitterBot
my_bot = TwitterBot(config_file='/path/to/config.txt')
premierball23 commented 9 years ago

Thank you for your help.

Within the config file, what should I input into:

ALREADY_FOLLOWED_FILE:already-followed.txt FOLLOWERS_FILE:followers.txt FOLLOWS_FILE:following.txt USERS_KEEP_FOLLOWING: # i want to keep following all of my users USERS_KEEP_UNMUTED: # all of the people i follow are unmuted USERS_KEEP_MUTED: # i dont have any muted followers

Basically, what should I input if i don't want any changes?

rhiever commented 9 years ago

The top 3 entries should point to the same directory as where you have the config.txt file so you keep everything in order.

If you want to keep following all of your users, then don't worry about USERS_KEEP_FOLLOWING and never use the auto_unfollow functions. Same for the auto_mute and auto_unmute functions.

premierball23 commented 9 years ago

I am fairly new to Python. I appreciate your help and patience. I am new to Python.

I have attached a picture of the error messages I'm receieving. 1) index error 2) index error: index out of range

Here are the contents of the config.txt file:

OAUTH_TOKEN:'myconfig' OAUTH_SECRET:'mysecret' CONSUMER_KEY:'mykey' CONSUMER_SECRET:'myconsecret' TWITTER_HANDLE:'myusername' ALREADY_FOLLOWED_FILE:already-followed.txt FOLLOWERS_FILE:followers.txt FOLLOWS_FILE:following.txt USERS_KEEP_FOLLOWING: USERS_KEEP_UNMUTED: USERS_KEEP_MUTED: FOLLOW_BACKOFF_MIN_SECONDS:10 FOLLOW_BACKOFF_MAX_SECONDS:60

image

rhiever commented 9 years ago

That's really strange - I can't reproduce this on my end. What if you just put 0s in these entries?

USERS_KEEP_FOLLOWING:0 USERS_KEEP_UNMUTED:0 USERS_KEEP_MUTED:0

premierball23 commented 9 years ago

When i put 0's in the entries, the same error occurs.

Is it possible that I messed something up in the init.py file for TwitterFollowBot? Errors kept coming up when i would enter "from TwitterFollowBot import FollowBot". The errors said "cannot import name Twitter". I looked in the Twitter folder and there wasn't a file called twitter, only twitter_globals. Within the same folder, oath was lower case and there was only a file named error. So I went into the init.py text and put in the following code:

"""from twitter import twitter_globals, oauth, error

the code used to read """from Twitter import Twitter, OAuth, (some long error)

rhiever commented 9 years ago

Have you installed the twitter module?

pip install twitter

It's a separate module.

premierball23 commented 9 years ago

Requirement already satisfied (use --upgrade to upgrade): twitter in c:\users\gus gabel\anaconda\lib\site-packages

Yes, the above statement means that it is installed.Maybe it is the wrong version? The twitter module only has files that reads oath.py, not OAth, and twitter.py, not Twitter.

rhiever commented 9 years ago

Do I understand right that you edited the code in __init__.py? You'll definitely want the code as it was before.

premierball23 commented 9 years ago

When I revert the init.py code back to the original, the following error message is shown:

In [1]: from TwitterFollowBot import TwitterBot

ImportError Traceback (most recent call last)

in () ----> 1 from TwitterFollowBot import TwitterBot C:\Users\Gus Gabel\Anaconda\lib\site-packages\TwitterFollowBot__init__.py in () 19 """ 20 from **future** import print_function ---> 21 from twitter import Twitter, OAuth, TwitterHTTPError 22 import os 23 import sys ImportError: cannot import name Twitter
premierball23 commented 9 years ago

i have attached a screenshot of the contents of the twitter module image

rhiever commented 9 years ago

Weird - it's acting like the twitter module isn't installed.

premierball23 commented 9 years ago

Then it could be my directory path?

ghost commented 9 years ago

gggg Please Help