I wrote the following code for my CPython extension :
#include <Python.h>
static PyObject *greeting(PyObject* self)
{
return Py_BuildValue("s" , "Hello python modules!!!");
}
static char *my_docstring = "This is a sample docstring";
static PyMethodDef greeting_funcs[] = {
{"greeting" , (PyCFunction)greeting , METH_NOARGS , my_docstring} , {NULL}
};
void initModule(void){
Py_InitModule3("greeting" , greeting_funcs , "Module example!!!");
}
And when I execute the following in IPython3 shell
from setuptools import setup , Extension
modules = [Extension('mod', sources=["/home/spm/python_module/mod.c"])]
setup(ext_modules=modules)
I get the error :
SystemExit: usage: ipython3 [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts]
or: ipython3 --help [cmd1 cmd2 ...]
or: ipython3 --help-commands
or: ipython3 cmd --help
error: no commands supplied
Any help is appreciated.
Thanks.