Instapy: can you ignore errors?

Created on 11 Dec 2017  Â·  8Comments  Â·  Source: timgrossmann/InstaPy

so i have got the following function to work and liking function however after liking about 6 tags it just stops and returns with error messages. I dont want that to stop my whole script is there any code i can use to ignore errors? or maybe in the set up add i code that will ignore errors. Thank you

help wanted question

Most helpful comment

this should be closed

All 8 comments

On Mon, 11 Dec 2017 at 00:25 drcyber975 notifications@github.com wrote:

so i have got the following function to work and liking function however
after liking about 6 tags it just stops and returns with error messages. I
dont want that to stop my whole script is there any code i can use to
ignore errors? or maybe in the set up add i code that will ignore errors.
Thank you

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/timgrossmann/InstaPy/issues/1077, or mute the thread
https://github.com/notifications/unsubscribe-auth/AALg_1jbVSeJ9Xxcvfsf2xYk-0Dmy7Diks5s_JKRgaJpZM4Q8yMU
.

Which error ?

To prevent errors from stopping your code execution, you can put the code inside a try-except block. For example:

try:
   Like function
   Follow function
   ...
except Exception as e:
   print e

friends don't let friends bypass exceptions :octocat:

this was the error message i recieved:
ERROR - follow loop error unable to open database fileO - --> Total people followed : 54
Traceback (most recent call last):
File "quickstart2.py", line 14, in
session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)
File "/home/lubuntu/InstaPy/instapy/instapy.py", line 1163, in follow_user_followers
self.logger)
File "/home/lubuntu/InstaPy/instapy/unfollow_util.py", line 694, in follow_given_user_followers
update_activity()
File "/home/lubuntu/InstaPy/instapy/util.py", line 77, in update_activity
data['unfollows'], data['server_calls']))
sqlite3.OperationalError: unable to open database file
lubuntu@lubuntu:~/InstaPy$

whenever i set up the script to like or follow it runs hlaf of the script and returns with werror messages. I am trying to make the script run for a number of hours through out the day and used the correct codes to to achieve this but it just seems to run the whole script only a smal part of it. I figured if i cant fix the error maybe i can set up a code at the start of the script to ignore the errors and hopefully move onto the next part of the script

try:
Like function
Follow function
...
except Exception as e:
print e

i will try adding this to my script and see if it helps

i will update you guys shorlty and thank you for taking the time to help me with my code you are the ony help i have lol

Like function
Follow function
...
except Exception as e:
print e

this did not work any other suggestions guys?

Please fix your instapy.db as my answer on your other question!

this should be closed

Was this page helpful?
0 / 5 - 0 ratings