Skip to content

Commit

Permalink
fix py3 compatibility regression in rpc.py after proto changes (near#493
Browse files Browse the repository at this point in the history
)
  • Loading branch information
azban authored Jan 29, 2019
1 parent b6eab2e commit 280675c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ def b58decode(s):

# Convert the string to an integer
n = 0
for c in s:
for char in s.encode('utf-8'):
n *= 58
if c not in alphabet:
msg = "Character {} is not a valid base58 character".format(c)
if char not in alphabet:
msg = "Character {} is not a valid base58 character".format(char)
raise Exception(msg)

digit = alphabet.index(c)
digit = alphabet.index(char)
n += digit

# Convert the integer to bytes
Expand Down Expand Up @@ -188,7 +188,7 @@ def _sign_transaction_body(self, body):

def _submit_transaction(self, transaction):
transaction = transaction.SerializeToString()
transaction = base64.b64encode(transaction)
transaction = base64.b64encode(transaction).decode('utf-8')
params = {'transaction': transaction}
return self._call_rpc('submit_transaction', params)

Expand All @@ -203,7 +203,7 @@ def _get_public_key(self):

null = open(os.devnull, 'w')
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=null)
stdout = process.communicate()[0].decode('utf-8')
stdout = process.communicate()[0]
if process.returncode != 0:
sys.stdout.write(stdout)

Expand All @@ -214,7 +214,7 @@ def _get_public_key(self):

exit(1)

self._public_key = stdout
self._public_key = stdout.decode('utf-8')
return self._public_key

def deploy_contract(self, sender, contract_name, wasm_file):
Expand Down

0 comments on commit 280675c

Please sign in to comment.