populus
populus copied to clipboard
testrpc server logs are leaking into stdout
- Populus Version: 2.2.0
- OS: osx
What was wrong?
Expected output:
~/G/t/greeter % python deploy.py
Head block is 0 on the testrpc chain
Owner address is 0x82A978B3f5962A5b0957d9ee9eEf472EE55B42F1
Deploying Greeter.sol
Greeter address is 0xc305c901078781c232a2a521c2af7980f8385ee9
Hello
Actual Output:
~/G/t/greeter % python deploy.py
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 44
Head block is 0 on the testrpc chain
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 83
Owner address is 0x82A978B3f5962A5b0957d9ee9eEf472EE55B42F1
Deploying Greeter.sol
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 48
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 44
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 1350
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 107
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 391
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 2143
Greeter address is 0xc305c901078781c232a2a521c2af7980f8385ee9
127.0.0.1 - - [22/Dec/2017 00:45:57] "POST / HTTP/1.1" 200 235
Hello
Source:
contract_name = 'Greeter'
chain_name = 'testrpc'
def deploy():
with Project().get_chain(chain_name) as chain:
print(f"Head block is {chain.web3.eth.blockNumber} on the {chain_name} chain")
owner = chain.web3.eth.coinbase
print('Owner address is', owner)
print(f'Deploying {contract_name}.sol')
instance = deploy_contract(chain, owner, contract_name)
print(f'{contract_name} address is', instance.address)
print(instance.call().greet())