eyeonus / TradeDangerous-listener

An EDDN listener, designed to work in conjunction with the EDDBlink plugin for Trade Dangerous.
GNU Lesser General Public License v3.0
4 stars 3 forks source link

Listener error since latest TD ( TD 5d4c537) #17

Closed Tromador closed 5 years ago

Tromador commented 5 years ago

Updated TD for the new stuff (EDDB v6 et al) and listener barfed:

Starting listener.
Running EDDBlink to perform any needed infrastructure updates.
NOTE: Import completed.
Traceback (most recent call last):
  File "./eddblink_listener.py", line 938, in <module>
    db_name, item_ids, system_ids, station_ids = update_dicts()
  File "./eddblink_listener.py", line 858, in update_dicts
    item_ids[item[iid_key]] =  int(item['unq:item_id'])
KeyError: 'unq:item_id'
eyeonus commented 5 years ago

Run eddblink plugin with clean option.

eyeonus commented 5 years ago

For some reason TD isn't marking that field as unique even though it should be. Hmmm...

eyeonus commented 5 years ago

Apparently it's something wrong with the exportTableToFile method in TD.

eyeonus commented 5 years ago

Found why:

def getUniqueIndex(conn, tableName):
    """ return the first unique index """
    idxCursor = conn.cursor()
    unqIndex = []
    for idxRow in idxCursor.execute("PRAGMA index_list('%s')" % tableName):
        if idxRow['unique']:
            # it's a unique index
            unqCursor = conn.cursor()
            for unqRow in unqCursor.execute("PRAGMA index_info('%s')" % idxRow['name']):
                unqIndex.append(unqRow['name'])
            return unqIndex <--- This is the problem.
    return unqIndex

It specifically states that it returns just the first unique index.

eyeonus commented 5 years ago

No need to update listener. Need to update TD and do any run that will re-export the Item.csv list- so '-O force,item' is the minimum.