console icon indicating copy to clipboard operation
console copied to clipboard

python部署智能合约报错:TypeError: isinstance() arg 2 must be a type or tuple of types

Open fang1418975997 opened this issue 1 year ago • 1 comments

(python-sdk) [root@slave03 python-sdk]# ./console.py call HelloWorld 0x9e028f06d7cd46d5d8651f2606bcd4dbf404150c set "Hello" "FISCO"

INFO >> user input : ['call', 'HelloWorld', '0x9e028f06d7cd46d5d8651f2606bcd4dbf404150c', 'set', 'Hello', 'FISCO']

INFO>> client info: channel 192.168.107.214:20200,groupid :1 INFO >> call HelloWorld , address: 0x9e028f06d7cd46d5d8651f2606bcd4dbf404150c, func: set, args:['Hello', 'FISCO'] exception happened! Traceback (most recent call last): File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in visit return method(node, [self.visit(n) for n in node]) File "/data/pythoncode/python-sdk/eth_abi/grammar.py", line 99, in generic_visit if isinstance(node.expr, expressions.Optional): TypeError: isinstance() arg 2 must be a type or tuple of types

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "./console.py", line 601, in main result = tx_client.call_and_decode(fn_name, fn_args) File "/data/pythoncode/python-sdk/client/common/transaction_common.py", line 202, in call_and_decode result = super().call(self.contract_addr, contract_abi, fn_name, args) File "/data/pythoncode/python-sdk/client/bcosclient.py", line 442, in call functiondata = encode_transaction_data(fn_name, contract_abi, None, args) File "/data/pythoncode/python-sdk/utils/contracts.py", line 209, in encode_transaction_data fn_identifier, contract_abi, fn_abi, args, kwargs, File "/data/pythoncode/python-sdk/utils/contracts.py", line 242, in get_function_info fn_abi = find_matching_fn_abi(contract_abi, fn_name, args, kwargs) File "/data/pythoncode/python-sdk/utils/contracts.py", line 89, in find_matching_fn_abi function_candidates = pipe(abi, name_filter, arg_count_filter, encoding_filter) File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe File "/data/pythoncode/python-sdk/utils/abi.py", line 254, in filter_by_encodability in contract_abi File "/data/pythoncode/python-sdk/utils/abi.py", line 255, in if check_if_arguments_can_be_encoded(function_abi, args, kwargs) File "/data/pythoncode/python-sdk/utils/abi.py", line 275, in check_if_arguments_can_be_encoded for _type, arg in zip(types, aligned_args) File "/data/pythoncode/python-sdk/utils/abi.py", line 275, in for _type, arg in zip(types, aligned_args) File "/data/pythoncode/python-sdk/eth_abi/codec.py", line 104, in is_encodable encoder = self._registry.get_encoder(typ) File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 453, in get_encoder return self._get_registration(self._encoders, type_str) File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 355, in _get_registration coder = super()._get_registration(mapping, type_str) File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 337, in _get_registration value = mapping.find(type_str) File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 85, in find (predicate, value) for predicate, value in self._values.items() File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 86, in if predicate(type_str) File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 230, in call abi_type = grammar.parse(type_str) File "/data/pythoncode/python-sdk/eth_abi/grammar.py", line 123, in parse return super().parse(type_str) File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 252, in parse return self._parse_or_match(text, pos, 'parse') File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 287, in _parse_or_match return self.visit(getattr(self.grammar, method_name)(text, pos=pos)) File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in visit return method(node, [self.visit(n) for n in node]) File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in return method(node, [self.visit(n) for n in node]) File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in visit return method(node, [self.visit(n) for n in node]) File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in return method(node, [self.visit(n) for n in node]) File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 225, in visit raise VisitationError(exc, exc_class, node) from exc parsimonious.exceptions.VisitationError: TypeError: isinstance() arg 2 must be a type or tuple of types

Parse tree: <Node matching ""> <-- *** We were here. ***

fang1418975997 avatar Jan 22 '24 08:01 fang1418975997