Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

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

Open
Chillimeat opened this issue Sep 26, 2021 · 1 comment
Open

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

Chillimeat opened this issue Sep 26, 2021 · 1 comment

Comments

@Chillimeat
Copy link

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:

@christian-korneck
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants