From 17cee6dcae08fccd15e6222b660bc182a489338d Mon Sep 17 00:00:00 2001 From: troymc Date: Tue, 10 May 2016 13:27:45 +0200 Subject: [PATCH] Made keypairs.py a Python 2 script again --- deploy-cluster-aws/write_keypairs_file.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/deploy-cluster-aws/write_keypairs_file.py b/deploy-cluster-aws/write_keypairs_file.py index 92e05584..cc36ecd5 100644 --- a/deploy-cluster-aws/write_keypairs_file.py +++ b/deploy-cluster-aws/write_keypairs_file.py @@ -1,12 +1,13 @@ """A Python 3 script to write a file with a specified number of keypairs, using bigchaindb.crypto.generate_key_pair() -The file is always named keypairs.py and it should be interpreted -as a Python 3 script. +The written file is always named keypairs.py and it should be +interpreted as a Python 2 script. Usage: $ python3 write_keypairs_file.py Using the list in other Python scripts: + # in a Python 2 script: from keypairs import keypairs_list # keypairs_list is a list of (sk, pk) tuples # sk = signing key (private key) @@ -30,9 +31,13 @@ num_pairs = int(args.num_pairs) # Generate and write the keypairs to keypairs.py print('Writing {} keypairs to keypairs.py...'.format(num_pairs)) with open('keypairs.py', 'w') as f: + f.write('# -*- coding: utf-8 -*-\n') f.write('"""A set of keypairs for use in deploying\n') f.write('BigchainDB servers with a predictable set of keys.\n') - f.write('"""\n\n') + f.write('"""\n') + f.write('\n') + f.write('from __future__ import unicode_literals\n') + f.write('\n') f.write('keypairs_list = [') for pair_num in range(num_pairs): keypair = crypto.generate_key_pair()