This repository was archived by the owner on Jul 24, 2023. It is now read-only.
Description the case is that when i use CallFunction to execute python module functions, and pass int type variable, it occur error like this:
[root@c7dev rootwd]# go build gptest/main.go
[root@c7dev rootwd]# ./main
panic: runtime error: cgo argument has Go pointer to Go pointer
goroutine 1 [running]:
github.com/sbinet/go-python.(* PyObject).CallFunction.func4(0xd0d510?, {0xc00004cf60?, 0x1, 0x0?}, 0xc00004ce48?, 0xc00004cef8)
/usr/local/gopath/pkg/mod/github.com/sbinet/go-python@v0.1.0/object.go:377 +0x89
github.com/sbinet/go-python.(* PyObject).CallFunction(0x4ae0f3?, {0xc00004cf60?, 0x1, 0x1})
/usr/local/gopath/pkg/mod/github.com/sbinet/go-python@v0.1.0/object.go:377 +0x205
main.main()
/root/rootwd/gptest/main.go:21 +0x66
here is my code:
package main
import (
"github.com/sbinet/go-python"
)
func init () {
err := python .Initialize ()
if err != nil {
panic (err .Error ())
}
}
func main () {
mod := python .PyImport_ImportModule ("tpy.test" )
fobj := mod .GetAttrString ("test" )
fobj .CallFunction ("aaa" ) // ok
fobj .CallFunction (1 ) // panic: runtime error: cgo argument has Go pointer to Go pointer
}
python module file:
# tpy.test
def test (data ):
print "xxxx" , data
I'm not sure if i use it in a wrong way.
Reactions are currently unavailable
the case is that when i use CallFunction to execute python module functions, and pass int type variable, it occur error like this:
here is my code:
python module file:
I'm not sure if i use it in a wrong way.