diff options
author | Skip Montanaro <skip@pobox.com> | 2003-02-03 15:29:34 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2003-02-03 15:29:34 (GMT) |
commit | da72d9376b7bcd2c9a532e83041caf3a713f7bc2 (patch) | |
tree | 2fc0ecbef1e1fa754840fbaf9108482aad09ae45 /Tools | |
parent | 7c1274d8ab5edd1d6e9d4dbca4d6332bfa3666dc (diff) | |
download | cpython-da72d9376b7bcd2c9a532e83041caf3a713f7bc2.zip cpython-da72d9376b7bcd2c9a532e83041caf3a713f7bc2.tar.gz cpython-da72d9376b7bcd2c9a532e83041caf3a713f7bc2.tar.bz2 |
try to avoid gross incompatibilities with older versions of Python
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/scripts/db2pickle.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Tools/scripts/db2pickle.py b/Tools/scripts/db2pickle.py index b445e93..59da765 100644 --- a/Tools/scripts/db2pickle.py +++ b/Tools/scripts/db2pickle.py @@ -33,7 +33,7 @@ except ImportError: prog = sys.argv[0] def usage(): - print >> sys.stderr, __doc__ % globals() + sys.stderr.write(__doc__ % globals()) def main(args): try: @@ -52,9 +52,9 @@ def main(args): else: dbfile = args[0] try: - pfile = file(args[1], 'wb') + pfile = open(args[1], 'wb') except IOError: - print >> sys.stderr, "Unable to open", args[1] + sys.stderr.write("Unable to open %s\n" % args[1]) return 1 dbopen = None @@ -63,36 +63,36 @@ def main(args): try: dbopen = bsddb.hashopen except AttributeError: - print >> sys.stderr, "bsddb module unavailable." + sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-b", "--btree"): try: dbopen = bsddb.btopen except AttributeError: - print >> sys.stderr, "bsddb module unavailable." + sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-r", "--recno"): try: dbopen = bsddb.rnopen except AttributeError: - print >> sys.stderr, "bsddb module unavailable." + sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-a", "--anydbm"): try: dbopen = anydbm.open except AttributeError: - print >> sys.stderr, "anydbm module unavailable." + sys.stderr.write("anydbm module unavailable.\n") return 1 elif opt in ("-d", "--dbm"): try: dbopen = dbm.open except AttributeError: - print >> sys.stderr, "dbm module unavailable." + sys.stderr.write("dbm module unavailable.\n") return 1 if dbopen is None: if bsddb is None: - print >> sys.stderr, "bsddb module unavailable -" - print >> sys.stderr, "must specify dbtype." + sys.stderr.write("bsddb module unavailable - ") + sys.stderr.write("must specify dbtype.\n") return 1 else: dbopen = bsddb.hashopen @@ -100,8 +100,8 @@ def main(args): try: db = dbopen(dbfile, 'r') except bsddb.error: - print >> sys.stderr, "Unable to open", dbfile, - print >> sys.stderr, "Check for format or version mismatch." + sys.stderr.write("Unable to open %s. " % dbfile) + sys.stderr.write("Check for format or version mismatch.\n") return 1 for k in db.keys(): |