Closed leobragaz closed 5 years ago
Hi, i'm trying to import a very simple module just to get familiar with your package but i wasn't able to do that.
This is my python file, which is placed in the same project folder of the go files.
# foo.py def hello(): """ Print hello world for fun and profit. """ print "hello, world!"
Main file following:
func main(){ py.Initialize() defer py.Finalize() fooModule := py.PyImport_ImportModule("foo") if fooModule == nil { panic("Error importing module") } helloFunc := fooModule.GetAttrString("hello") if helloFunc == nil { panic("Error importing function") } helloFunc.Call(py.PyTuple_New(0), py.PyDict_New()) }
When i build it i'll get an error cause the fooModule is actual NIL, and i don't know why, i can't find any similar problems online. Thanks in advance for help!
it's probably an issue with your $PYTHONPATH. what is its value? and where is your foo.py file?
$PYTHONPATH
foo.py
Yes it was the $PYTHONPATH not set correctly. Now it works!
Hi, i'm trying to import a very simple module just to get familiar with your package but i wasn't able to do that.
This is my python file, which is placed in the same project folder of the go files.
Main file following:
When i build it i'll get an error cause the fooModule is actual NIL, and i don't know why, i can't find any similar problems online. Thanks in advance for help!