From a9cb3364a2ce2736f3fad8b14855fbf1333e8df5 Mon Sep 17 00:00:00 2001 From: niljub Date: Tue, 20 Aug 2024 08:59:54 +0200 Subject: [PATCH] found a solution that is testable and works in manual testing --- bittensor/subtensor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bittensor/subtensor.py b/bittensor/subtensor.py index f9b27cb93a..d9768cbeca 100644 --- a/bittensor/subtensor.py +++ b/bittensor/subtensor.py @@ -4254,8 +4254,13 @@ def get_subnets(self, block: Optional[int] = None) -> List[int]: """ result = self.query_map_subtensor("NetworksAdded", block) subnets = [] + for data in result: - subnets.append(data[0]) + continue + # Check if the 'records' attribute exists and is not None + if hasattr(result, "records") and result.records: + subnets = [subnet[0].value for subnet in result.records] + return subnets def get_all_subnets_info(self, block: Optional[int] = None) -> List[SubnetInfo]: