Reputation: 13
I got a question when running the Jupyter Notebook Tutorial file which provides in Hyperledger Fabric Python SDK. The error occurs when I try to run the code which could install an example chaincode which can be found at test/fixtures/chaincode
on the peers
of org1
.
It shows error: the loop is not defined. But when I add the code before loop = asyncio.get_event_loop()
. It also shows error: RuntimeError: This event loop is already running.
How can I solve this problem?
Upvotes: 0
Views: 400
Reputation: 2874
Looks like the python sdk tutorial you're referring to is: https://github.com/hyperledger/fabric-sdk-py/blob/master/Tutorial.ipynb
and this references contract: https://github.com/hyperledger/fabric-sdk-py/blob/master/test/fixtures/chaincode/src/github.com/example_cc/example_cc.go
The first loops is this one:
Run the below code snippet to install an example chaincode which can be found at test/fixtures/chaincode on the peers of org1.
In [ ]:
# This installs the example chaincode on the peers
# Make the client know there is a channel in the network
cli.new_channel('businesschannel')
#The GOPTAH settings is required for only running the example chaincode in the SDK
import os
gopath_bak = os.environ.get('GOPATH', '')
gopath = os.path.normpath(os.path.join(
os.path.dirname(os.path.realpath('__file__')),
'test/fixtures/chaincode'
))
# The response should be true if succeed
responses = loop.run_until_complete(cli.chaincode_install( <<<<<<<<< Here
requestor=org1_admin,
peers=['peer0.org1.example.com',
'peer1.org1.example.com'],
cc_path='github.com/example_cc',
cc_name='example_cc',
cc_version='v1.0'
))
If you can confirm some of this with a comment response or include it in your post above it might help get an answer. I've just read the question and tried searching for the bits of info your referring to... without explicit examples of what you're talking about, you're going to find it hard to get a response though.
Upvotes: 1