8 VFS::LOG( QString(
"Loading module '%1'").arg(
path), 9,
"python");
12 module = PyImport_ImportModule(qUtf8Printable(
path));
14 if (module ==
nullptr)
20 VFS::ERROR( QString(
"Failed to load module '%1'").arg(
path), 0,
"python" );
33 PyObject *pFunc = PyObject_GetAttrString(
object, qUtf8Printable(method));
37 if (PyCallable_Check(pFunc))
39 PyObject *result = PyObject_CallObject(pFunc,args);
42 if (PyString_Check(result))
43 ret = QString(PyString_AsString(result));
56 VFS::WARN( QString(
"Can't call '%1' method.").arg(method) );
92 PyObject *ptype, *pvalue, *ptraceback;
93 PyObject *stype, *svalue;
94 PyErr_Fetch(&ptype, &pvalue, &ptraceback);
99 stype = PyObject_Str(ptype);
100 char *errorMessage = PyString_AsString(stype);
104 svalue = PyObject_Str(pvalue);
105 char *errorType = PyString_AsString(svalue);
109 if (ptype) Py_DECREF(ptype);
110 if (pvalue) Py_DECREF(pvalue);
111 if (ptraceback) Py_DECREF(ptraceback);
113 VFS::ERROR( QString(
"%1").arg(errorMessage), 0,
"python" );
114 VFS::ERROR( QString(
"%1").arg(errorType), 0,
"python" );
static void LOG(QString message, int level=0, QString user="server")
Send a message to the VFS::_messages VFS_stream.
static void ERROR(QString message, int level=0, QString user="server")
Send a message to the VFS::_errors VFS_stream.
static void WARN(QString message, int level=0, QString user="server")
Send a message to the VFS::_warnings VFS_stream.
getter path
a getter DOCME
QString callObjectMethod(PyObject *object, QString method, PyObject *args=nullptr)
PyObject * loadModule(QString path)