Closed gixxerfrank closed 4 years ago
Hey @gixxerfrank,
We did a quick check and this issue looks very darn similar to
This could be a coincidence, but if any of these issues solves your problem then I did a good job :smile:
If not, the maintainers will get to this issue shortly.
Cheers, Your Friendly Neighborhood ProBot
Please follow the guide below
x
into all the boxes [ ] relevant to your issue (like so [x]).Before submitting an issue, make sure you have:
Purpose of your issue?
The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.
For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.
Paste the output of
3.7.2
here:Code:
-- coding: utf-8 --
import os import sys import threading import time from glob import glob
import config
sys.path.append(os.path.join(sys.path[0], "../../")) import schedule # noqa: E402 from instabot import Bot, utils # noqa: E402
bot = Bot( comments_file=config.COMMENTS_FILE, blacklist_file=config.BLACKLIST_FILE, whitelist_file=config.WHITELIST_FILE, friends_file=config.FRIENDS_FILE, ) bot.login() bot.logger.info("RosieBotV3")
random_user_file = utils.file(config.USERS_FILE) random_hashtag_file = utils.file(config.HASHTAGS_FILE) photo_captions_file = utils.file(config.PHOTO_CAPTIONS_FILE) posted_pic_list = utils.file(config.POSTED_PICS_FILE).list
pics = sorted([os.path.basename(x) for x in glob(config.PICS_PATH + "/*.jpg")])
def stats(): bot.save_user_stats(bot.user_id)
def like_hashtags(): bot.like_hashtag(random_hashtag_file.random(), amount=300 // 24)
def like_timeline(): bot.like_timeline(amount=200 // 24)
def like_followers_from_random_user_file(): bot.like_followers(random_user_file.random(), nlikes=3)
def follow_followers(): bot.follow_followers( random_user_file.random(), nfollows=config.NUMBER_OF_FOLLOWERS_TO_FOLLOW )
def comment_medias():
bot.comment_medias(bot.get_timeline_medias())
def unfollow_non_followers(): bot.unfollow_non_followers( n_to_unfollows=config.NUMBER_OF_NON_FOLLOWERS_TO_UNFOLLOW )
def follow_users_from_hashtag_file(): bot.follow_users(bot.get_hashtag_users(random_hashtag_file.random()))
def comment_hashtag():
def upload_pictures(): # Automatically post a pic in 'pics' folder
def put_non_followers_on_blacklist(): # put non followers on blacklist try: bot.logger.info("Creating non-followers list") followings = set(bot.following) followers = set(bot.followers) friends = bot.friends_file.set # same whitelist (just user ids) non_followers = followings - followers - friends for user_id in non_followers: bot.blacklist_file.append(user_id, allow_duplicates=False) bot.logger.info("Done.") except Exception as e: bot.logger.error("Couldn't update blacklist") bot.logger.error(str(e))
def run_threaded(job_fn): job_thread = threading.Thread(target=job_fn) job_thread.start()
schedule.every(1).hour.do(run_threaded, stats) schedule.every(1).hours.do(run_threaded, like_hashtags) schedule.every(1).hours.do(run_threaded, like_timeline) schedule.every(1).days.at("22:00").do( run_threaded, like_followers_from_random_user_file ) schedule.every(2).days.at("11:00").do(run_threaded, follow_followers)
schedule.every(16).hours.do(run_threaded, comment_medias)
schedule.every(1).days.at("08:00").do(run_threaded, unfollow_non_followers) schedule.every(12).hours.do(run_threaded, follow_users_from_hashtag_file)
schedule.every(6).hours.do(run_threaded, comment_hashtag)
schedule.every(1).days.at("21:28").do(run_threaded, upload_pictures)
schedule.every(4).days.at("07:50").do(run_threaded, put_non_followers_on_blacklist)
while True: schedule.run_pending() time.sleep(1)
Describe your issue
when the script is running this error pops up and I am unsure why.
Exception in thread Thread-7:
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/Users/frankbernardo/Projects/Digitize_V4/gixxerfrank/examples/ultimate_schedule/ultimate.py", line 37, in like_hashtags bot.like_hashtag(random_hashtag_file.random(), amount=300 // 24) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/instabot/bot/bot.py", line 722, in like_hashtag return like_hashtag(self, hashtag, amount) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/instabot/bot/bot_like.py", line 252, in like_hashtag hashtag_id=hashtag_id, UnboundLocalError: local variable 'hashtag_id' referenced before assignment