diff PyPluginObject.cpp @ 43:36cc53aad853

Test output values a bit; fix input conversion from int
author Chris Cannam
date Wed, 03 Dec 2014 08:25:05 +0000
parents 9dd449a19004
children f12b59c022a5
line wrap: on
line diff
--- a/PyPluginObject.cpp	Wed Nov 26 18:17:40 2014 +0000
+++ b/PyPluginObject.cpp	Wed Dec 03 08:25:05 2014 +0000
@@ -401,10 +401,10 @@
     } else {
         
         if (!PyList_Check(pyBuffer)) {
-            PyErr_SetString(PyExc_TypeError, "List of NumPy Array required for process input.");
+            PyErr_SetString(PyExc_TypeError, "List of NumPy arrays or lists of numbers required for process input");
             return data;
         }
-
+        
         if (PyList_GET_SIZE(pyBuffer) != channels) {
 //            cerr << "Wrong number of channels: got " << PyList_GET_SIZE(pyBuffer) << ", expected " << channels << endl;
             PyErr_SetString(PyExc_TypeError, "Wrong number of channels");
@@ -414,6 +414,10 @@
         for (int c = 0; c < channels; ++c) {
             PyObject *cbuf = PyList_GET_ITEM(pyBuffer, c);
             data.push_back(conv.PyValue_To_FloatVector(cbuf));
+            if (conv.error) {
+                PyErr_SetString(PyExc_TypeError, conv.getError().str().c_str());
+                return vector<vector<float> >();
+            }
         }
     }