mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
2009-01-30 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Python_API.cpp, rulesets/Python_API.h: Hack in a quick function for executing python commands. * server/CommPythonClient.cpp: Pass input from the client straight into the python interpretter and see what happens.
This commit is contained in:
parent
ac7665e3c0
commit
0bbbfe7dae
4 changed files with 27 additions and 1 deletions
|
|
@ -1153,3 +1153,16 @@ void shutdown_python_api()
|
|||
|
||||
Py_Finalize();
|
||||
}
|
||||
|
||||
void run_python_command(const char * s)
|
||||
{
|
||||
static PyObject * context = 0;
|
||||
|
||||
if (context == 0) {
|
||||
context = PyDict_New();
|
||||
PyDict_SetItemString(context, "__builtins__", PyEval_GetBuiltins() );
|
||||
}
|
||||
|
||||
PyRun_String(s, Py_single_input, context, context);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue