view scripts/dump_dbm_sessions_db.py @ 6632:e7143e4f6753

try to update to python 3.10.4 from 3.10.0 and try 3.11 Travis ci doesn't seem to tell us what python versions are supported. The one form that is supposed to show that doesn't work for me. Also it looks like nightly is suck at 3.10.0a5+ which isn't nightly. python 3.10.4 is released and current. 3.11 is pre-release/nightly so trying it to replace broken nightly. These upgrades may need to be reverted if invalid.
author John Rouillard <rouilj@ieee.org>
date Sat, 16 Apr 2022 17:04:20 -0400
parents 61481d7bbb07
children 1188bb423f92
line wrap: on
line source

#! /usr/bin/env python3
"""Usage: dump_dbm_sessions_db.py [filename]

Simple script to dump the otks and sessions dbm databases.  Dumps
sessions db in current directory if no argument is given.

Dump format:

   key: <timestamp> data

where <timestamp> is the human readable __timestamp decoded from the
data object.

"""

import dbm, marshal, sys
from datetime import datetime

try:
  file = sys.argv[1]
except IndexError:
  file="sessions"

try:
   db = dbm.open(file)
except Exception:
   print("Unable to open database: %s"%file)
   exit(1)

k = db.firstkey()
while k is not None:
    d = marshal.loads(db[k])
    t = datetime.fromtimestamp(d['__timestamp'])
    print("%s: %s %s"%(k, t, d))
    k = db.nextkey(k)

Roundup Issue Tracker: http://roundup-tracker.org/