首页 > 解决方案 > 关于 Hyperledger Fabric Python SDK 的问题

问题描述

在运行Hyperledger Fabric Python SDK中提供的Jupyter Notebook 教程文件时,我遇到了一个问题。当我尝试运行可以安装示例链代码的代码时发生错误,该示例链代码可以在.test/fixtures/chaincodepeersorg1

它显示错误:未定义循环。但是当我添加之前的代码时loop = asyncio.get_event_loop()。它还显示错误:RuntimeError:此事件循环已在运行。

我怎么解决这个问题?

标签: hyperledger-fabric

解决方案


看起来您所指的python sdk教程是:https ://github.com/hyperledger/fabric-sdk-py/blob/master/Tutorial.ipynb

这个参考合同:https ://github.com/hyperledger/fabric-sdk-py/blob/master/test/fixtures/chaincode/src/github.com/example_cc/example_cc.go

第一个循环是这个:

运行以下代码片段以安装示例链代码,该示例链代码可以在 org1 的对等点的 test/fixtures/chaincode 中找到。

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'
               ))

如果您可以通过评论回复确认其中的一些内容或将其包含在您上面的帖子中,它可能有助于获得答案。我刚刚阅读了这个问题,并尝试搜索您所指的信息……如果没有您所谈论内容的明确示例,您会发现很难得到回应。


推荐阅读