Instapy: ERROR - follow loop error unable to open database file???

Created on 11 Dec 2017  路  15Comments  路  Source: timgrossmann/InstaPy

This was the code i used;
from instapy import InstaPy

insta_username = 'username'
insta_password = 'password'

nogui=True
session = InstaPy(username=insta_username, password=insta_password)
session.login()

session.set_upper_follower_count(limit=900)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_','realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=3600)

session.follow_user_followers(['kimkardashian', 'selenagomez', 'cosplay.world_', 'realdonaldtrump'], amount=17, randomize=False, sleep_delay=60)

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$

is there anyway i can ignore the errors so it will move onto the next line of code and carry on the function? or have i made a mistake in my code? i managed to follow 54 people and then the script stopped and told me that there was a follow loop error how do i get past this issue?

help wanted wontfix

All 15 comments

what's your instapy.db permissions ?
try: chmod 755 instapy.db

Maybe It wasn't properly closed or still open in other execution. Try:
ps aux | grep python
And kill the zombie processes that are still running.

instapy.db permissions ? i am unsure what this is is instapy.db one of the config files that i need to alter? i will look ino thish now

i found the instaoy.db but i am unsure how to open it did you open it using a custom command line?

how do i set instapy.db permissions to chmod 755 instapy.db? can you please explain further on the process of this? Thank you

@drcyber975 what's your system ?

i am using windows 10 and ubuntu

im really confused now because a script i amde yesterday was working fine until it ran into an error but now the script it wont even run without me making any alterations to it. there some kind of bug with the automation or i havent configured everything properly

  1. Take a look under folder /InstaPy/db to check if instapy.db file is there! If not, pick it from github/instapy...
  2. If its there, please check the permission of this file. Probably change it to 755 (on linux, mac)

@converge Please take a look it its possible to create a new instapy database, when the file wrongly not existed! Thanks

@davidrocket the question is, in which situation instapy.db would not exist.. ?

@converge Some git-magic with refactoring, pushing, fetching, cherry-picking, squashing ... :) as I did... would ignoring the instapy.db

Or simply being pushed in .gitignore, because this database as I guessed, is being used on "production" :) and should not be overwriten with the local one

@davidrocket got it.

adding database to .gitignore isn't a good idea because people will not receive new improvements. We can do it when we have a stable version, the project is in constant change.

Hey guys, I've followed the "Preferred installation" from the Readme, which installs InstaPy as a library in my virtual environment. However, when I run the quickstart.py, I run into the error where sqilite cannot find the instapy.db file.

I've printed out Settings.database_location and copied the instapy.db file from the repo to that location.

However, trying to run quickstart.py now, I run into issues such as:

  File "quickstart.py", line 9, in <module>
    session.login()
  File "/Users/renierbotha/anaconda3/envs/test-insta/lib/python3.6/site-packages/instapy/instapy.py", line 322, in login
    self.bypass_suspicious_attempt):
  File "/Users/renierbotha/anaconda3/envs/test-insta/lib/python3.6/site-packages/instapy/login_util.py", line 100, in login_user
    update_activity()
  File "/Users/renierbotha/anaconda3/envs/test-insta/lib/python3.6/site-packages/instapy/util.py", line 43, in update_activity
    cur.execute("SELECT * FROM statistics WHERE created == date('now')")
sqlite3.OperationalError: no such table: statistics

This all stems from the fact that I dont really understand how the database is created and do not know how to specify where I want my database file to be located other than by editing the settings.py file (which seems hacky).

Any help would be appreciated.

@converge @davidrocket tagging you guys cause you seem to have the know-how.

You can try to find the /site-package/ folder and add the db folder from instapy in it. That solved the problem for me but i am using miniconda so the path might be different.

If you have access to an interpreter just import instapy and do instapy.__file__ and it will show you where your __init__.py is located.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Naramsim picture Naramsim  路  3Comments

ghost picture ghost  路  3Comments

Spyd3r0us picture Spyd3r0us  路  3Comments

rahulkapoor90 picture rahulkapoor90  路  3Comments

ingorichter picture ingorichter  路  3Comments