Fixes up "EDMC.py -j" for python3

This commit is contained in:
Athanasius committed 2020-06-21 16:23:01 +01:00
1 parent 67708fd090
commit ddf2babaaa
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -78,7 +78,7 @@ try:
if args.j:
# Import and collate from JSON dump
data = json.load(open(args.j))
config.set('querytime', getmtime(args.j))
config.set('querytime', int(getmtime(args.j)))
else:
# Get state from latest Journal file
try:
+2 -2
View File
@@ -129,7 +129,7 @@ def addships(data):
ships[int(row['id'])] = row # index by int for easier lookup and sorting
size_pre = len(ships)
for ship in (data['lastStarport']['ships'].get('shipyard_list') or {}).values() + data['lastStarport']['ships'].get('unavailable_list'):
for ship in list((data['lastStarport']['ships'].get('shipyard_list') or {}).values()) + data['lastStarport']['ships'].get('unavailable_list'):
# sanity check
key = ship['id']
new = { 'id': int(key), 'symbol': ship['name'], 'name': companion.ship_map.get(ship['name'].lower()) }
@@ -152,7 +152,7 @@ def addships(data):
os.unlink(shipfile+'.bak')
os.rename(shipfile, shipfile+'.bak')
with open(shipfile, 'wb') as csvfile:
with open(shipfile, 'w') as csvfile:
writer = csv.DictWriter(csvfile, ['id', 'symbol', 'name'])
writer.writeheader()
for key in sorted(ships):