truongnmt / flask-iroha

Using Flask as REST API to communicate with Iroha Hyperledger いろは
2 stars 1 forks source link

Couldn't build proto file into descriptor pool! #1

Open mleinadm opened 4 years ago

mleinadm commented 4 years ago

I am getting the error:

TypeError: Couldn't build proto file into descriptor pool! Invalid proto descriptor for file "primitive.proto": primitive.proto: A file with this name is already in the pool.

` Traceback (most recent call last):

File ".\app.py", line 4, in

import iroha_schema.iroha_helper as IrohaHelper 

File "E:\git\iroha\flask-iroha\iroha_schema\iroha_helper.py", line 4, in import iroha_schema.transaction_pb2 as transaction_pb2 File "E:\git\iroha\flask-iroha\iroha_schema\transaction_pb2.py", line 16, in import iroha_schema.commands_pb2 as commandspb2 File "E:\git\iroha\flask-iroha\iroha_schema\commands_pb2.py", line 16, in import iroha_schema.primitive_pb2 as primitivepb2 File "E:\git\iroha\flask-iroha\iroha_schema\primitive_pb2.py", line 23, in

serialized_pb=_b('\n\x0fprimitive.proto\x12\x0eiroha.protocol\"2\n\tSignature\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\")\n\x04Peer\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x10\n\x08peer_key\x18\x02 \x01(\x0c\xe6\x08\n\x0eRolePermission\x12\x13\n\x0f\x63\x61n_append_role\x10\x00\x12\x13\n\x0f\x63\x61n_create_role\x10\x01\x12\x13\n\x0f\x63\x61n_detach_role\x10\x02\x12\x15\n\x11\x63\x61n_add_asset_qty\x10\x03\x12\x1a\n\x16\x63\x61n_subtract_asset_qty\x10\x04\x12\x10\n\x0c\x63\x61n_add_peer\x10\x05\x12\x15\n\x11\x63\x61n_add_signatory\x10\x06\x12\x18\n\x14\x63\x61n_remove_signatory\x10\x07\x12\x12\n\x0e\x63\x61n_set_quorum\x10\x08\x12\x16\n\x12\x63\x61n_create_account\x10\t\x12\x12\n\x0e\x63\x61n_set_detail\x10\n\x12\x14\n\x10\x63\x61n_create_asset\x10\x0b\x12\x10\n\x0c\x63\x61n_transfer\x10\x0c\x12\x0f\n\x0b\x63\x61n_receive\x10\r\x12\x15\n\x11\x63\x61n_create_domain\x10\x0e\x12\x13\n\x0f\x63\x61n_read_assets\x10\x0f\x12\x11\n\rcan_get_roles\x10\x10\x12\x16\n\x12\x63\x61n_get_my_account\x10\x11\x12\x18\n\x14\x63\x61n_get_all_accounts\x10\x12\x12\x1b\n\x17\x63\x61n_get_domain_accounts\x10\x13\x12\x1a\n\x16\x63\x61n_get_my_signatories\x10\x14\x12\x1b\n\x17\x63\x61n_get_all_signatories\x10\x15\x12\x1e\n\x1a\x63\x61n_get_domain_signatories\x10\x16\x12\x16\n\x12\x63\x61n_get_my_acc_ast\x10\x17\x12\x17\n\x13\x63\x61n_get_all_acc_ast\x10\x18\x12\x1a\n\x16\x63\x61n_get_domain_acc_ast\x10\x19\x12\x19\n\x15\x63\x61n_get_my_acc_detail\x10\x1a\x12\x1a\n\x16\x63\x61n_get_all_acc_detail\x10\x1b\x12\x1d\n\x19\x63\x61n_get_domain_acc_detail\x10\x1c\x12\x16\n\x12\x63\x61n_get_my_acc_txs\x10\x1d\x12\x17\n\x13\x63\x61n_get_all_acc_txs\x10\x1e\x12\x1a\n\x16\x63\x61n_get_domain_acc_txs\x10\x1f\x12\x1a\n\x16\x63\x61n_get_my_acc_ast_txs\x10 \x12\x1b\n\x17\x63\x61n_get_all_acc_ast_txs\x10!\x12\x1e\n\x1a\x63\x61n_get_domain_acc_ast_txs\x10\"\x12\x12\n\x0e\x63\x61n_get_my_txs\x10#\x12\x13\n\x0f\x63\x61n_get_all_txs\x10$\x12\x12\n\x0e\x63\x61n_get_blocks\x10\x12\x1f\n\x1b\x63\x61n_grant_can_set_my_quorum\x10%\x12\"\n\x1e\x63\x61n_grant_can_add_my_signatory\x10&\x12%\n!can_grant_can_remove_my_signatory\x10\'\x12$\n can_grant_can_transfer_my_assets\x10(\x12\'\n#can_grant_can_set_my_account_detail\x10)*\x9e\x01\n\x13GrantablePermission\x12\x18\n\x14\x63\x61n_add_my_signatory\x10\x00\x12\x1b\n\x17\x63\x61n_remove_my_signatory\x10\x01\x12\x15\n\x11\x63\x61n_set_my_quorum\x10\x02\x12\x1d\n\x19\x63\x61n_set_my_account_detail\x10\x03\x12\x1a\n\x16\x63\x61n_transfer_my_assets\x10\x04\x62\x06proto3')

File "C:\Python\lib\site-packages\google\protobuf\descriptor.py", line 884, in new return _message.default_pool.AddSerializedFile(serialized_pb)

TypeError: Couldn't build proto file into descriptor pool! Invalid proto descriptor for file "primitive.proto": primitive.proto: A file with this name is already in the pool. `

any help?

truongnmt commented 4 years ago

This repo is a little bit outdated tho. I developed 2 years ago since Iroha python SDK have to build from source.

A quick look in Iroha Python SDK seems that import Iroha a lot easier.

from iroha import Iroha, IrohaCrypto, IrohaGrpc

Of course, method calls are changed so that need to be fixed too.

Feel free to open any PR. Thanks!