tdjson.dll: cannot open shared object file: No such file or directory (python)

Created on 10 Mar 2018  路  5Comments  路  Source: tdlib/td

I successfully compiled tdlib, using the manual https://github.com/isopen/docker/blob/master/tdlib/Dockerfile.debian

Then:

$ python tdjson_example.py
Traceback (most recent call last):
File "tdjson_example.py", line 10, in <module>
tdjson = CDLL(tdjson_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: tdjson.dll: cannot open shared object file: No such file or directory

Most helpful comment

tdjson_example.py::

from ctypes.util import find_library
from ctypes import *
import json
import sys

tdjson_path = "/usr/local/lib/libtdjson.so"
if tdjson_path is None:
    print('can\'t find tdjson library')
    quit()
tdjson = CDLL(tdjson_path)

td_json_client_create = tdjson.td_json_client_create
td_json_client_create.restype = c_void_p
td_json_client_create.argtypes = []
...

Also, check that the libtdjson.so file is exactly in /usr/local/lib/and it is available for reading to the current user.

All 5 comments

td/build$ make install
Output:
Install the project...
-- Install configuration: "Release"
...
-- Installing: /usr/local/lib/libtdjson.so
...
Success.

Then:
td/example/python$ python tdjson_example.py
Traceback (most recent call last):
File "tdjson_example.py", line 10, in <module>
tdjson = CDLL(tdjson_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libtdjson.so: cannot open shared object file: No such file or directory

Try to explicitly prescribe the path to the library.

tdjson_path = "your way to the library"
example: tdjson_path = "/usr/local/lib/libtdjson.so"

Try it...

root@web:/srv/www/td/example/python# tdjson_path = "/usr/local/lib/libtdjson.so"
-bash: tdjson_path: command not found
root@web:/srv/www/td/example/python# export tdjson_path = "/usr/local/lib/libtdjson.so"
-bash: export:=': not a valid identifier -bash: export: /usr/local/lib/libtdjson.so': not a valid identifier
root@web:/srv/www/td/example/python# export tdjson_path="/usr/local/lib/libtdjson.so"
root@web:/srv/www/td/example/python# echo $tdjson_path
/usr/local/lib/libtdjson.so
root@web:/srv/www/td/example/python# python tdjson_example.py
Traceback (most recent call last):
File "tdjson_example.py", line 10, in <module>
tdjson = CDLL(tdjson_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libtdjson.so: cannot open shared object file: No such file or directory

tdjson_example.py::

from ctypes.util import find_library
from ctypes import *
import json
import sys

tdjson_path = "/usr/local/lib/libtdjson.so"
if tdjson_path is None:
    print('can\'t find tdjson library')
    quit()
tdjson = CDLL(tdjson_path)

td_json_client_create = tdjson.td_json_client_create
td_json_client_create.restype = c_void_p
td_json_client_create.argtypes = []
...

Also, check that the libtdjson.so file is exactly in /usr/local/lib/and it is available for reading to the current user.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joshchernoff picture joshchernoff  路  5Comments

L11R picture L11R  路  4Comments

hatami57 picture hatami57  路  4Comments

sh-a-v picture sh-a-v  路  3Comments

rdlrt picture rdlrt  路  3Comments