sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.53k stars 138 forks source link

python function retuan tuple type how to receive in my golang script #60

Closed jjjachyty closed 6 years ago

jjjachyty commented 6 years ago

python


def callProcedure(prdocedureName,unixDate):
    os.environ['NLS_LANG'] = "American_America.AL32UTF8"
    try:
        conn = cx_Oracle.connect("tjlrm", "tjlrm", "172.168.171.200/xe")
        cursor = conn.cursor()
        asofdate = datetime.datetime.strptime(time.strftime("%Y-%m-%d", time.localtime(unixDate)), '%Y-%m-%d')
        param4 = cursor.var(cx_Oracle.BOOLEAN)  # plsql出参

        param5 = cursor.var(cx_Oracle.STRING)  # plsql出参

        # 调用存储过程
        cursor.callproc(prdocedureName, [asofdate,param4,param5])  # ['Nick', 'Nick, Good Morning!']

        return True,param4,param5.getvalue()
    except Exception as e:
        print("错误",e)
        return False,False,e.__str__()
    finally:
    # 资源关闭
        cursor.close()
        conn.close()```

how to get  `return True,param4,param5.getvalue()` Tuple  in my golang script? 
jjjachyty commented 6 years ago
returnFlag := python.PyTuple_GetItem(out, 0)
returnMsg := python.PyTuple_GetItem(out, 1)