Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Executing python commands thru exec.Command

10 views
Skip to first unread message

kavitha kannan

unread,
Apr 12, 2021, 3:27:29 AM4/12/21
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.







0 new messages