C
C
Caspergreen2018-09-11 13:53:37
Python
Caspergreen, 2018-09-11 13:53:37

How to get data returned by .so library in python?

Good day, I have the code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,os,optparse,ctypes,platform,time

login = 'admin'
passw  = '123456'
host  = '10.10.15.61'
port  = '37777'

def Auth():
  dll = ctypes.CDLL('./libdhnetsdk.so')
        init = dll.CLIENT_Init(host.encode('ascii'), 0)
        dll.CLIENT_Login.restype = ctypes.c_longlong
        loginH = dll.CLIENT_Login(host.encode('ascii'), port.encode('ascii'), login.encode('ascii'), passw.encode('ascii'), 0)
        print(loginH)
Auth()

When I print out the loginH variable, it returns 0, how do I know what is returned by the loaded library?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2018-09-11
@sergey-gornostaev

The function CLIENT_Loginreturns 0 on error. Perhaps the error occurs because the second parameter must be a number and not a string.

S
Soho, 2015-03-19
@labyrinths

See if there are localization files ru_RU.po and ru_RU.mo in the template, if there are, change them using the Poedit program. Just as a way, you download a program for searching text in files (@Text Replacer) and check all files for text, then change them in all files in which text was found. Perhaps you are changing in the wrong file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question