Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fang1418975997 opened this issue Jan 22, 2024 · 1 comment

Comments

@fang1418975997
Copy link

(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. ***

@Anyna918
Copy link

Anyna918 commented Aug 2, 2024

Hello, do you solve your problem? I meet the same one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants