2

I am trying to call python function from C++ to do some computation in python. Following is a dummy snippet which reproduces my issue.

def mktUpdate(token):
    print("PY : ", token)
    return 1
PyObject* pyResult = PyObject_CallObject(pyMktUpdate, pyArgs);
std::cout << "Output " << PyLong_AsLong(pyResult) << std::endl;

Following code prints 1 (as expected) if I comment the print("PY"...) part. But as soon as I start printing from python method it returns -1 always. Printing from python is not important for me, I just want to understand what is happening. Any help would be appreciated. Thanks.

Abhishek Kumar
  • 729
  • 6
  • 20

0 Answers0