This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Description
Describe what happened:
python3.7 ubuntu18.04
run main.go get error
SyntaxError: invalid syntax (uuid.py, line 138)
demo.py
y = 6
import time
import uuid
def testF():
global y
y = y-2
# print(uuid.uuid4())
return 2*y*time.time()*uuid.uuid4()
if __name__ == "__main__":
testF()
main.go
package main
import (
"fmt"
"github.com/DataDog/go-python3"
)
func main() {
python3.Py_Initialize()
defer python3.Py_Finalize()
if !python3.Py_IsInitialized() {
panic("Error initializing the python interpreter")
}
var err error
err = python3.PySys_SetPath("/opt/gopwn/")
if err != nil {
panic("ERROR: Path set error.")
}
dir := "/usr/local/lib/python3.7/dist-packages"
python3.PyRun_SimpleString("import sys\nsys.path.append(\"" + dir + "\")")
pModule := python3.PyImport_ImportModule("test.demo.demo")
if pModule == nil {
panic("ERROR: Module not found.")
}
}
Describe what you expected:
run main.go get error
`Traceback (most recent call last):
File "/opt/gopwn/test/demo/demo1.py", line 4, in
import uuid
SyntaxError: invalid syntax (uuid.py, line 138)
panic: ERROR: Module not found.
goroutine 1 [running]:
`
Steps to reproduce the issue: