go-python3 icon indicating copy to clipboard operation
go-python3 copied to clipboard

SyntaxError: invalid syntax (uuid.py, line 138)

Open Chillimeat opened this issue 4 years ago • 1 comments

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:

Chillimeat avatar Sep 26 '21 10:09 Chillimeat

I don't get what you're trying to demonstrate. Can you elaborate?

christian-korneck avatar Oct 03 '21 22:10 christian-korneck