1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
/*-------------------------------------------------------------------------
*
* pyrun.c
* Stand-alone program to test with embedded Python.
*
* Run a Python program read from stdin. In case of error return 1.
*
* Copyright (c) 2011-2021 Daniele Varrazzo <daniele.varrazzo@gmail.com>
*
*-------------------------------------------------------------------------
*/
#include <Python.h>
int
main(int argc, char *argv[])
{
int rv = 0;
Py_Initialize();
if (0 != PyRun_SimpleFile(stdin, "stdin")) {
rv = 1;
}
Py_Finalize();
return rv;
}
|