aiohttp-json-rpc icon indicating copy to clipboard operation
aiohttp-json-rpc copied to clipboard

ValueError: list.remove(x): x not in list ib rpc.py modle

Open Noor-Kalibbala opened this issue 3 years ago • 3 comments

the snippet below

async def _ws_send_str(self, client, string):
    if client.ws._writer.transport.is_closing():
        self.clients.remove(client)
        await client.ws.close()

cause the error below self.clients.remove(client) ValueError: list.remove(x): x not in list

Noor-Kalibbala avatar Apr 09 '21 12:04 Noor-Kalibbala

Hi @Noor-Kalibbala! Could you try if this snippet solves your problem?

async def _ws_send_str(self, client, string):
    if client.ws._writer.transport.is_closing():
        if client in self.clients:
            self.clients.remove(client)

        await client.ws.close()

fscherf avatar Apr 09 '21 13:04 fscherf

@fscherf this error it randomly happens, anyway u mean i replace the previous snippet with this snippet in package source code

Noor-Kalibbala avatar Apr 09 '21 13:04 Noor-Kalibbala

@fscherf thanks, it works well

Noor-Kalibbala avatar Apr 09 '21 13:04 Noor-Kalibbala