pytonlib icon indicating copy to clipboard operation
pytonlib copied to clipboard

Error in tonlibjson.__del__: 'TonLib' object has no attribute '_tonlib_json_client_destroy'

Open QuiteHorn opened this issue 3 years ago • 8 comments

raceback (most recent call last):
  File "D:\tonTgWallet\main.py", line 6, in <module>
    client.init_tonlib()
  File "D:\tonTgWallet\venv\lib\site-packages\ton\sync.py", line 19, in syncified
    return loop.run_until_complete(coro)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "D:\tonTgWallet\venv\lib\site-packages\ton\client\tonlib_methods.py", line 67, in init_tonlib
    wrapper = TonLib(self.loop, self.ls_index, cdll_path, self.verbosity_level, default_timeout=self.default_timeout)
  File "D:\tonTgWallet\venv\lib\site-packages\ton\tonlibjson.py", line 92, in __init__
    tonlib = CDLL(cdll_path)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'D:\tonTgWallet\venv\lib\site-packages\ton\distlib\windows\tonlibjson.amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Exception in tonlibjson.__del__: Traceback (most recent call last):
  File "D:\tonTgWallet\venv\lib\site-packages\ton\tonlibjson.py", line 133, in __del__
    self._tonlib_json_client_destroy(self._client)
AttributeError: 'TonLib' object has no attribute '_tonlib_json_client_destroy'

Exception ignored in: <function TonLib.__del__ at 0x000002593A6F0CA0>
Traceback (most recent call last):
  File "D:\tonTgWallet\venv\lib\site-packages\ton\tonlibjson.py", line 136, in __del__
RuntimeError: Error in tonlibjson.__del__: 'TonLib' object has no attribute '_tonlib_json_client_destroy'

Getting this issue so can't just start my script

The whole code:

from ton.sync import TonlibClient


client = TonlibClient(ls_index=None)
TonlibClient.enable_unaudited_binaries()
client.init_tonlib()

wallet = client.create_wallet()
print(wallet)

QuiteHorn avatar Feb 19 '23 09:02 QuiteHorn

Try to provide path for ur libtonlibjson.so file like this client.init_tonlib(cdll_path='/usr/bin/ton/tonlib/libtonlibjson.so').

CWDT250 avatar Mar 14 '23 14:03 CWDT250

maybe open SSL version is not suitable, try to Install OpenSSL v1.1.1 for Win64 from https://slproweb.com/products/Win32OpenSSL.html.

jiweiyx avatar Apr 01 '23 00:04 jiweiyx

have this problem too

xmdnx avatar Jun 16 '23 23:06 xmdnx

How did you guys solve this issue? I am having it when i tried to deploy on AWS, locally works, seems its something related to cdll_path

estevanpedro avatar Jul 21 '23 01:07 estevanpedro

I had a similar error in Ubuntu 22.04, but I had this error caused by the absence of libcrypto.so.1.1: OSError: libcrypto.so.1.1: cannot open shared object file: No such file or directory To solve this problem, I used the following method: https://stackoverflow.com/a/72633324

ergashev avatar Aug 11 '23 12:08 ergashev

have this problem too

lee-qinghua avatar Aug 16 '23 14:08 lee-qinghua

I have the same situation, please help me

TQK0209 avatar May 31 '24 15:05 TQK0209