![](https://secure.gravatar.com/avatar/0a9d559e0271fbb2cda4aa88b97f6bbe.jpg?s=120&d=mm&r=g)
Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv11207 Modified Files: db2pickle.py pickle2db.py Log Message: allow dump/load of gdbm files Index: db2pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/db2pickle.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db2pickle.py 20 Jun 2003 01:00:20 -0000 1.4 --- db2pickle.py 28 Oct 2003 16:17:54 -0000 1.5 *************** *** 2,6 **** """ ! Synopsis: %(prog)s [-h|-b|-r] dbfile [ picklefile ] Convert the database file given on the command line to a pickle --- 2,6 ---- """ ! Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ] Convert the database file given on the command line to a pickle *************** *** 22,25 **** --- 22,29 ---- dbm = None try: + import gdbm + except ImportError: + gdbm = None + try: import anydbm except ImportError: *************** *** 38,43 **** def main(args): try: ! opts, args = getopt.getopt(args, "hbrda", ! ["hash", "btree", "recno", "dbm", "anydbm"]) except getopt.error: usage() --- 42,48 ---- def main(args): try: ! opts, args = getopt.getopt(args, "hbrdag", ! ["hash", "btree", "recno", "dbm", ! "gdbm", "anydbm"]) except getopt.error: usage() *************** *** 83,86 **** --- 88,97 ---- except AttributeError: sys.stderr.write("anydbm module unavailable.\n") + return 1 + elif opt in ("-g", "--gdbm"): + try: + dbopen = gdbm.open + except AttributeError: + sys.stderr.write("gdbm module unavailable.\n") return 1 elif opt in ("-d", "--dbm"): Index: pickle2db.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pickle2db.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pickle2db.py 20 Jun 2003 01:01:19 -0000 1.5 --- pickle2db.py 28 Oct 2003 16:17:54 -0000 1.6 *************** *** 2,6 **** """ ! Synopsis: %(prog)s [-h|-b|-r|-a|-d] dbfile [ picklefile ] Read the given picklefile as a series of key/value pairs and write to a new --- 2,6 ---- """ ! Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] dbfile [ picklefile ] Read the given picklefile as a series of key/value pairs and write to a new *************** *** 26,29 **** --- 26,33 ---- dbm = None try: + import gdbm + except ImportError: + gdbm = None + try: import anydbm except ImportError: *************** *** 42,47 **** def main(args): try: ! opts, args = getopt.getopt(args, "hbrda", ! ["hash", "btree", "recno", "dbm", "anydbm"]) except getopt.error: usage() --- 46,52 ---- def main(args): try: ! opts, args = getopt.getopt(args, "hbrdag", ! ["hash", "btree", "recno", "dbm", "anydbm", ! "gdbm"]) except getopt.error: usage() *************** *** 87,90 **** --- 92,101 ---- except AttributeError: sys.stderr.write("anydbm module unavailable.\n") + return 1 + elif opt in ("-g", "--gdbm"): + try: + dbopen = gdbm.open + except AttributeError: + sys.stderr.write("gdbm module unavailable.\n") return 1 elif opt in ("-d", "--dbm"):