X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/a41fd652df29e991c71b40f7b6cab2062d8bd1b3..25e3ebd45318f009677e79dc8768cfc1b7810f0f:/pwsafe diff --git a/pwsafe b/pwsafe index 6a3dfae..205df23 100644 --- a/pwsafe +++ b/pwsafe @@ -51,7 +51,7 @@ prog = re.sub(r'^.*[/\\]', '', argv[0]) def moan(msg): """Issue a warning message MSG.""" - print >>stderr, '%s: %s' % (prog, msg) + stderr.write('%s: %s\n' % (prog, msg)) def die(msg): """Report MSG as a fatal error, and exit.""" @@ -99,7 +99,7 @@ def cmd_changepp(av): def cmd_find(av): if len(av) != 1: return 1 with PW(file) as pw: - try: print pw[av[0]] + try: print(pw[av[0]]) except KeyError: die("Password `%s' not found" % _excval().args[0]) def cmd_store(av): @@ -131,7 +131,7 @@ def cmd_list(av): if len(av) >= 1: pat = av[0] else: pat = None for k in pw: - if pat is None or fnmatch(k, pat): print k + if pat is None or fnmatch(k, pat): print(k) def cmd_topixie(av): if len(av) > 2: return 1 @@ -186,18 +186,18 @@ commands = { 'create': [cmd_create, ### Command-line handling and dispatch. def version(): - print '%s 1.0.0' % prog - print 'Backend types: %s' % \ - ' '.join([c.NAME for c in StorageBackend.classes()]) + print('%s 1.0.0' % prog) + print('Backend types: %s' % + ' '.join([c.NAME for c in StorageBackend.classes()])) def usage(fp): - print >>fp, 'Usage: %s COMMAND [ARGS...]' % prog + fp.write('Usage: %s COMMAND [ARGS...]\n' % prog) def help(): version() - print + print('') usage(stdout) - print ''' + print(''' Maintains passwords or other short secrets securely. Options: @@ -209,9 +209,9 @@ Options: -f, --file=FILE Where to find the password-safe file. Commands provided: -''' +''') for c in sorted(commands): - print '%s %s' % (c, commands[c][1]) + print('%s %s' % (c, commands[c][1])) ## Choose a default database file. if 'PWSAFE' in environ: @@ -252,7 +252,7 @@ else: c = 'find' try: if commands[c][0](argv): - print >>stderr, 'Usage: %s %s %s' % (prog, c, commands[c][1]) + stderr.write('Usage: %s %s %s\n' % (prog, c, commands[c][1])) exit(1) except DecryptError: die("decryption failure")