Skip to content

The first example from the documentation leads to an error. RuntimeError: Error in tonlibjson.__del__: 'TonLib' object has no attribute '_tonlib_json_client_destroy' #63

Description

@QuisEgoSum

pytonlib 0.0.63
python 3.11

import requests
import asyncio
from pathlib import Path

from pytonlib import TonlibClient


async def main():
    # downloading mainnet config
    ton_config = requests.get('https://ton.org/global.config.json').json()

    # create keystore directory for tonlib
    keystore_dir = '/tmp/ton_keystore'
    Path(keystore_dir).mkdir(parents=True, exist_ok=True)

    # init TonlibClient
    client = TonlibClient(ls_index=0,  # choose LiteServer index to connect
                          config=ton_config,
                          keystore=keystore_dir)

    # init tonlibjson
    await client.init()


if __name__ == '__main__':
    asyncio.run(main())
Traceback (most recent call last):
  File "<rootPath>/main.py", line 26, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "<rootPath>/main.py", line 22, in main
    await client.init()
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytonlib/client.py", line 71, in init
    wrapper = TonLib(event_loop, self.ls_index, self.cdll_path, self.verbosity_level)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytonlib/tonlibjson.py", line 81, in __init__
    tonlib = CDLL(cdll_path)
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libsecp256k1.so.0: cannot open shared object file: No such file or directory
Exception in tonlibjson.__del__: Traceback (most recent call last):
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytonlib/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 0x7f50ba77cd60>
Traceback (most recent call last):
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytonlib/tonlibjson.py", line 136, in __del__
RuntimeError: Error in tonlibjson.__del__: 'TonLib' object has no attribute '_tonlib_json_client_destroy'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions