When I try to return the value at a specific position from my database and store the value to a text file I get the following error:
Argument must be a string or a number, not 'ResultProxy'.
int(expire) and str(expire) won't convert a 'ResultProxy'.
def expire():
today = datetime.date.today()
day = today.strftime('%d %b %y')
conn = engine.connect()
sql = text('select account.expire from account where account.user_name = "%s"'%('Bob'))
expire = conn.execute(sql)
filename = 'mysite/expiry.txt'
read = open(filename, 'r')
target = open(filename, 'w')
target.truncate()
target.write(str(expire))
target.write("\n")
target.close()
read = open(filename, 'r')
daysleft = read
return render_template('expire.html', daysleft=daysleft)
how do I convert the ResultProxy into a string?