yungwine / pytoniq

TON Blockchain SDK with native ADNL protocols implementations
96 stars 27 forks source link

AttributeError: 'NoneType' object has no attribute 'write' #40

Open pusteckiy opened 2 months ago

pusteckiy commented 2 months ago

Got this error while getting account state.

File "/home/cloud/src/parsers/user.py", line 113, in get_user_data
    state = await client.get_account_state(sc_address)
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/balancer.py", line 353, in get_account_state
    return await self.execute_method('get_account_state', **self._get_args(locals()))
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/balancer.py", line 267, in execute_method
    resp = await peer_meth(*args, **kwargs)
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/client.py", line 488, in get_account_state
    return SimpleAccount.from_raw((await self.raw_get_account_state(address))[0], address)
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/client.py", line 462, in raw_get_account_state
    result = await self.liteserver_request('getAccountState', data)
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/client.py", line 288, in liteserver_request
    return await self.liteserver_query(data, qid)
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/client.py", line 275, in liteserver_query
    resp = await self.send_and_encrypt(data, qid)
  File "/home/cloud/env/lib/python3.10/site-packages/pytoniq/liteclient/client.py", line 137, in send_and_encrypt
    self.writer.write(self.encrypt(data))
AttributeError: 'NoneType' object has no attribute 'write'
pavelhardzei commented 1 month ago

Got the same error for unknown reason while parsing transactions. Managed to solve just replaced declaration of LiteBalancer using context manager ( async with statement )