mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
Fix encoding errors on send_transaction()
This commit is contained in:
parent
261cd342dd
commit
3ad3a6082b
6 changed files with 42 additions and 4 deletions
|
@ -4,6 +4,7 @@ import logging
|
|||
import operator
|
||||
import re
|
||||
import sys
|
||||
import six
|
||||
|
||||
from monero.backends.jsonrpc import JSONRPCDaemon
|
||||
from monero.daemon import Daemon
|
||||
|
@ -36,9 +37,9 @@ elif args.verbosity > 1:
|
|||
level = logging.DEBUG
|
||||
logging.basicConfig(level=level, format="%(asctime)-15s %(message)s")
|
||||
if args.tx_filenames:
|
||||
blobs = [(f, open(f, 'r').read()) for f in args.tx_filenames]
|
||||
blobs = [(f, open(f, 'rb').read()) for f in args.tx_filenames]
|
||||
else:
|
||||
blobs = [('transaction', sys.stdin.read())]
|
||||
blobs = [('transaction', sys.stdin.buffer.read() if six.PY3 else sys.stdin.read())]
|
||||
d = Daemon(JSONRPCDaemon(timeout=args.timeout, proxy_url=args.proxy_url, **args.daemon_rpc_url))
|
||||
for name, blob in blobs:
|
||||
logging.debug("Sending {}".format(name))
|
||||
|
|
|
@ -63,6 +63,6 @@ for tx in txns:
|
|||
if args.outdir:
|
||||
outname = os.path.join(args.outdir, tx.hash + '.tx')
|
||||
outfile = open(outname, 'wb')
|
||||
outfile.write(tx.blob.encode())
|
||||
outfile.write(tx.blob)
|
||||
outfile.close()
|
||||
print(u"Transaction saved to {}".format(outname))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue