Instapy: Error occured while getting a DB profile for 'None'

Created on 1 Aug 2018  路  11Comments  路  Source: timgrossmann/InstaPy

This error seems like is intermittent, happens from time to time. But not always.
First run:

root@<machine>:~/InstaPy# python3 <file_name>.py 
WARNING [2018-08-01 07:53:25] [<username>]  Heeh! Error occured while getting a DB profile for 'None':
    b'NOT NULL constraint failed: profiles.name'
Traceback (most recent call last):
  File "<file_name>.py", line 24, in <module>
    multi_logs=True)
  File "/root/InstaPy/instapy/instapy.py", line 192, in __init__
    get_db(True)
  File "/root/InstaPy/instapy/database_engine.py", line 75, in get_db
    id = get_profile(name, address, logger) if (id is None or make==True) else id
  File "/root/InstaPy/instapy/database_engine.py", line 110, in get_profile
    profile = dict(profile)
TypeError: 'NoneType' object is not iterable

Second run:

root@<machine>:~/InstaPy# python3 <file_name>.py 

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2018-08-01 07:53:29] [<username>]  Session started!

Expected Behavior

Run python file with actions

Current Behavior

Intermitent error

WARNING [2018-08-01 07:53:25] [<username>]  Heeh! Error occured while getting a DB profile for 'None':
    b'NOT NULL constraint failed: profiles.name'

Most helpful comment

Having same issue when following "Running with Docker microservices manual"

All 11 comments

Reverted my local repo to commit 0ab19ddd5775e0d194e6426560ff52892c1e519f.
No errors anymore.

So I think the problem may be after that commit?

Same issue here.

Forwarded to 99cf2b01e68cb28e07eb8f708afe14cc1ce445c0 and problem is not occuring
Last working commit:

commit 99cf2b01e68cb28e07eb8f708afe14cc1ce445c0
Author: meinert <[email protected]>
Date:   Mon Jul 30 10:20:06 2018 +0200

    Changed XPATH other place

Had to cherry pick bc6983b203e462a8cd5d9a050f81f54de9201d9e and 1587095abeb66dbcd7dd385155444e246deb185f in order to get it working back again.

Revert @uluQulu commits on Dedicated Data Base to provide robust 'record activity' and 'follow restriction' and support future DB operations easily also worked.

@rafaelfcsouza quick fix for it , on database_engine.py in line 3 add import time and in line 83 add time.sleep(2)

import os
import sqlite3
import time

from .settings import Settings
def get_profile(name, address, logger):
    time.sleep(2)
    """ Get a profile for users and return its id """
    try:

@Mehran Not working for me, still have the issue.

Still happens when I follow "run in Docker" guide

Having same issue when following "Running with Docker microservices manual"

WARNING [2019-05-19 16:26:41] [None] Heeh! Error occurred while getting a DB prof ile for 'None': b'NOT NULL constraint failed: profiles.name' ._. ._. ._. ._. ._. ._. ._. ._. ._. ._. ._. No any custom workspace provided. ~using existing.. ._. ._. ._. ._. ._. ._. ._. ._. ._. Workspace in use: "C:/Users/user/InstaPy" Traceback (most recent call last): File "quickstart.py", line 13, in session = InstaPy() File "D:\Bots\InstaPy\instapy\instapy.py", line 292, in __init__ get_database(make=True) # IMPORTANT: think twice before relocating File "D:\Bots\InstaPy\instapydatabase_engine.py", line 60, in get_database id = get_profile(name, address, logger) if id is None or make else id File "D:\Bots\InstaPy\instapydatabase_engine.py", line 147, in get_profile profile = dict(profile) TypeError: 'NoneType' object is not iterable

I was getting the same error on Mac using python3.7.
It turns out for me that the problem was that I was getting insta_username with os.environ.get('IG_BOT_USER') and for some reason insta_username was None.

I fixed it by hardcoded the username before setting the workspace. Hope it helps

Was this page helpful?
0 / 5 - 0 ratings