Executing python commands thru exec.Command

3 views
Skip to first unread message

kavitha kannan

unread,
Apr 12, 2021, 3:27:29 AMApr 12
to
I am new to Go and in my current project, I have to call an external module from Go.
The external folder is C++ (wrapped with Python) and requires to access
a sub function under the c++ folder.
The shared library (.so) was included along with main.go

go /src
/main
testfile.go
headfiles.go
cprog.so

under headdfiles.go, I have declared two functions
func headfile() {}
func DelKeys() {}

In Python, the code is called in this manner.
self.__cprog = cprog.TCP(dev, headfile.getData, DelKeys, kwargs)

where headfile and DelKeys are class with own methods.

From the Go, I have challenge in calling using exec.command
cmd, err:= exec.Command("python","-c","import cprog;cprog.TCP()")

Looking for suggestions in how to access the functions from external folder (.so) file.







Reply all
Reply to author
Forward
0 new messages