I am reading from an sqlite3 database and filtering out NoneType, since I only want values which are not None. I tried both methods suggested here, with identical results. This leads me to think that the below if-statement is correct, but I am missing something more fundamental. Any suggestions are appreciated.
Reading from Databse
        conn.commit()
        c.execute("SELECT tact FROM LineOEE03 ORDER BY tact DESC LIMIT 1")
        current_tact = c.fetchone()
NoneType test
        if current_tact is not None:
            current_tact = int(current_tact[0])
        else:
            current_tact = 60
Error
current_tact = int(current_tact[0])TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
- Why am I getting this error if I am specifically tageting not Nonetypes in myif-statement?
- What is the correct way to do this, such when the value is NoneI can assign a pre-defined value?
 
     
    