psylopunk / pytonlib

Simple python client for The Open Network
https://pydocs.xton.me/
MIT License
93 stars 19 forks source link

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

Open QuiteHorn opened 1 year ago

QuiteHorn commented 1 year ago
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)
CWDT250 commented 1 year ago

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

jiweiyx commented 1 year ago

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

xmdnx commented 1 year ago

have this problem too

estevanpedro commented 1 year ago

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

ergashev commented 1 year ago

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

lee-qinghua commented 1 year ago

have this problem too

TQK0209 commented 5 months ago

I have the same situation, please help me

Morrigan-Ship commented 2 months ago

To solve this problem, I used the following method: https://stackoverflow.com/a/72633324

fixed thank you