Не могу найти ошибку в скрипте Python...
Выводит 1 строку :
root@BlackPhreaker:~/Desktop/osmocom_script# python print_db_1.py
259962166 | XXXXXXXXXXXXXX | XXXXXXXXXXXXXX | 2018-11-03 21:04:15 | 2018-11-19 03:47:13 | 2018-11-19 04:48:13 | 2535
А должен выводить 4 строки:
root@BlackPhreaker:~/Desktop/osmocom_script# python print_db_1.py
259962166 | XXXXXXXXXXXXXX | XXXXXXXXXXXXXX | 2018-11-03 21:04:15 | 2018-11-19 03:47:13 | 2018-11-19 04:48:13 | 2535
259962166 | XXXXXXXXXXXXXX | XXXXXXXXXXXXXX | 2018-11-03 21:04:15 | 2018-11-19 03:47:13 | 2018-11-19 04:48:13 | 2535
2552628735 | XXXXXXXXXXXXXX | XXXXXXXXXXXXXX | 2018-11-12 23:44:36 | 2018-11-19 03:07:28 | 2018-11-13 00:46:17 | 0
2552628735 | XXXXXXXXXXXXXX | XXXXXXXXXXXXXX | 2018-11-12 23:44:36 | 2018-11-19 03:07:28 | 2018-11-13 00:46:17 | 0
#!/usr/bin/python
# -*- coding: utf-8 -*-
#======================================================================================
#======================================================================================
import sqlite3
db = sqlite3.connect('/root/Desktop/hlr.sqlite3')
def read_sql_db():
with db:
cur = db.cursor()
cur.execute("SELECT s.tmsi as TMSI," #
"s.imsi as IMSI,"
"e.imei as IMEI,"
"s.created as CREATED,"
"s.updated as UPDATED, " ##/!\##
"s.expire_lu as EXPIRE,"
"s.lac as LAC "
"FROM Subscriber s,"
"EquipmentWatch ew,"
"Equipment e "
"WHERE s.id = ew.subscriber_id")
while True:
row = cur.fetchone()
if row == None:
break
global TMSIS
global IMSIS
global IMEIS
global CREATED
global UPDATED
global EXPIRE
global LACS
TMSIS = row[0]
IMSIS = row[1]
IMEIS = row[2]
CREATED = row[3]
UPDATED = row[4]
EXPIRE = row[5]
LACS = row[6]
return TMSIS,IMSIS,IMEIS,CREATED,UPDATED,EXPIRE,LACS
return None,None,None,None,None,None,None
# cur.close()
read_sql_db()
print("{:11} | {:15} | {:15} | {} | {} | {} | {:8}".format(TMSIS,IMSIS,IMEIS,CREATED,UPDATED,EXPIRE,LACS))