Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set Error Handler to CPLQuietErrorHandler

Silencing everything that goes wrong is probably not a good long term
solution. At some point a custom error handler should be created.
  • Loading branch information...
commit 11a3d1bb348b3d4784628d4d047bd4d1ceafe6c0 1 parent 26036c7
Michael Weisman authored
View
3  src/mill/collection.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.14.1 on Thu Aug 4 10:44:36 2011 */
+/* Generated by Cython 0.14.1 on Thu Aug 4 11:15:14 2011 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -221,6 +221,7 @@
#include <math.h>
#define __PYX_HAVE_API__mill__collection
#include "ogr_api.h"
+#include "cpl_error.h"
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
View
3  src/mill/ograpi.pxd
@@ -35,3 +35,6 @@ cdef extern from "ogr_api.h":
void * OGROpenShared (char *path, int mode, void *x)
int OGRReleaseDataSource (void *datasource)
+cdef extern from "cpl_error.h":
+ void CPLSetErrorHandler (void *handler)
+ void * CPLQuietErrorHandler
View
2  src/mill/ogrinit.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.14.1 on Thu Aug 4 10:44:36 2011 */
+/* Generated by Cython 0.14.1 on Thu Aug 4 11:15:14 2011 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
View
118 src/mill/workspace.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.14.1 on Thu Aug 4 10:44:37 2011 */
+/* Generated by Cython 0.14.1 on Thu Aug 4 11:15:15 2011 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -221,6 +221,7 @@
#include <math.h>
#define __PYX_HAVE_API__mill__workspace
#include "ogr_api.h"
+#include "cpl_error.h"
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
@@ -580,13 +581,22 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
* # start session
* cogr_ds = ograpi.OGROpen(self.path, 0, NULL) # <<<<<<<<<<<<<<
*
- * n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
+ * # Silence null pointer errors if there are no layers
*/
__pyx_t_2 = PyBytes_AsString(((struct __pyx_obj_4mill_9workspace_Workspace *)__pyx_v_self)->path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_cogr_ds = OGROpen(__pyx_t_2, 0, NULL);
- /* "mill/workspace.pyx":31
- * cogr_ds = ograpi.OGROpen(self.path, 0, NULL)
+ /* "mill/workspace.pyx":33
+ * # Silence null pointer errors if there are no layers
+ * # At some point this should be changed to a custom handler
+ * ograpi.CPLSetErrorHandler(ograpi.CPLQuietErrorHandler) # <<<<<<<<<<<<<<
+ *
+ * n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
+ */
+ CPLSetErrorHandler(CPLQuietErrorHandler);
+
+ /* "mill/workspace.pyx":35
+ * ograpi.CPLSetErrorHandler(ograpi.CPLQuietErrorHandler)
*
* n = ograpi.OGR_DS_GetLayerCount(cogr_ds) # <<<<<<<<<<<<<<
* for i in range(n):
@@ -594,7 +604,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
*/
__pyx_v_n = OGR_DS_GetLayerCount(__pyx_v_cogr_ds);
- /* "mill/workspace.pyx":32
+ /* "mill/workspace.pyx":36
*
* n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
* for i in range(n): # <<<<<<<<<<<<<<
@@ -605,7 +615,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_i = __pyx_t_4;
- /* "mill/workspace.pyx":33
+ /* "mill/workspace.pyx":37
* n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
* for i in range(n):
* cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i) # <<<<<<<<<<<<<<
@@ -614,7 +624,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
*/
__pyx_v_cogr_layer = OGR_DS_GetLayer(__pyx_v_cogr_ds, __pyx_v_i);
- /* "mill/workspace.pyx":34
+ /* "mill/workspace.pyx":38
* for i in range(n):
* cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i)
* cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer) # <<<<<<<<<<<<<<
@@ -623,7 +633,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
*/
__pyx_v_cogr_layerdefn = OGR_L_GetLayerDefn(__pyx_v_cogr_layer);
- /* "mill/workspace.pyx":35
+ /* "mill/workspace.pyx":39
* cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i)
* cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer)
* layer_name = ograpi.OGR_FD_GetName(cogr_layerdefn) # <<<<<<<<<<<<<<
@@ -632,18 +642,18 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
*/
__pyx_v_layer_name = OGR_FD_GetName(__pyx_v_cogr_layerdefn);
- /* "mill/workspace.pyx":36
+ /* "mill/workspace.pyx":40
* cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer)
* layer_name = ograpi.OGR_FD_GetName(cogr_layerdefn)
* collection = Collection(layer_name, self) # <<<<<<<<<<<<<<
* collections[layer_name] = collection
*
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Collection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Collection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyBytes_FromString(__pyx_v_layer_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyBytes_FromString(__pyx_v_layer_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
@@ -651,7 +661,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self);
__Pyx_GIVEREF(__pyx_v_self);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
@@ -659,20 +669,20 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
__pyx_v_collection = __pyx_t_5;
__pyx_t_5 = 0;
- /* "mill/workspace.pyx":37
+ /* "mill/workspace.pyx":41
* layer_name = ograpi.OGR_FD_GetName(cogr_layerdefn)
* collection = Collection(layer_name, self)
* collections[layer_name] = collection # <<<<<<<<<<<<<<
*
* # end session
*/
- __pyx_t_5 = PyBytes_FromString(__pyx_v_layer_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyBytes_FromString(__pyx_v_layer_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
- if (PyDict_SetItem(((PyObject *)__pyx_v_collections), ((PyObject *)__pyx_t_5), __pyx_v_collection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(((PyObject *)__pyx_v_collections), ((PyObject *)__pyx_t_5), __pyx_v_collection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
}
- /* "mill/workspace.pyx":40
+ /* "mill/workspace.pyx":44
*
* # end session
* ograpi.OGR_DS_Destroy(cogr_ds) # <<<<<<<<<<<<<<
@@ -681,7 +691,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
*/
OGR_DS_Destroy(__pyx_v_cogr_ds);
- /* "mill/workspace.pyx":42
+ /* "mill/workspace.pyx":46
* ograpi.OGR_DS_Destroy(cogr_ds)
*
* return collections # <<<<<<<<<<<<<<
@@ -709,7 +719,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
return __pyx_r;
}
-/* "mill/workspace.pyx":46
+/* "mill/workspace.pyx":50
* property collections:
* # A lazy property
* def __get__(self): # <<<<<<<<<<<<<<
@@ -726,27 +736,27 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_11collections___get__(PyOb
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__get__");
- /* "mill/workspace.pyx":47
+ /* "mill/workspace.pyx":51
* # A lazy property
* def __get__(self):
* if not self._collections: # <<<<<<<<<<<<<<
* self._collections = self._read_collections()
* return self._collections
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_4mill_9workspace_Workspace *)__pyx_v_self)->_collections); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_4mill_9workspace_Workspace *)__pyx_v_self)->_collections); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
- /* "mill/workspace.pyx":48
+ /* "mill/workspace.pyx":52
* def __get__(self):
* if not self._collections:
* self._collections = self._read_collections() # <<<<<<<<<<<<<<
* return self._collections
*
*/
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___read_collections); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___read_collections); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_GIVEREF(__pyx_t_4);
@@ -758,7 +768,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_11collections___get__(PyOb
}
__pyx_L5:;
- /* "mill/workspace.pyx":49
+ /* "mill/workspace.pyx":53
* if not self._collections:
* self._collections = self._read_collections()
* return self._collections # <<<<<<<<<<<<<<
@@ -783,7 +793,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_11collections___get__(PyOb
return __pyx_r;
}
-/* "mill/workspace.pyx":51
+/* "mill/workspace.pyx":55
* return self._collections
*
* def __getitem__(self, name): # <<<<<<<<<<<<<<
@@ -799,7 +809,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_2__getitem__(PyObject *__p
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__getitem__");
- /* "mill/workspace.pyx":52
+ /* "mill/workspace.pyx":56
*
* def __getitem__(self, name):
* return self.collections.__getitem__(name) # <<<<<<<<<<<<<<
@@ -807,17 +817,17 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_2__getitem__(PyObject *__p
* def keys(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____getitem__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____getitem__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_INCREF(__pyx_v_name);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name);
__Pyx_GIVEREF(__pyx_v_name);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
@@ -839,7 +849,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_2__getitem__(PyObject *__p
return __pyx_r;
}
-/* "mill/workspace.pyx":54
+/* "mill/workspace.pyx":58
* return self.collections.__getitem__(name)
*
* def keys(self): # <<<<<<<<<<<<<<
@@ -854,7 +864,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_3keys(PyObject *__pyx_v_se
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("keys");
- /* "mill/workspace.pyx":55
+ /* "mill/workspace.pyx":59
*
* def keys(self):
* return self.collections.keys() # <<<<<<<<<<<<<<
@@ -862,12 +872,12 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_3keys(PyObject *__pyx_v_se
* def values(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -887,7 +897,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_3keys(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "mill/workspace.pyx":57
+/* "mill/workspace.pyx":61
* return self.collections.keys()
*
* def values(self): # <<<<<<<<<<<<<<
@@ -902,7 +912,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_4values(PyObject *__pyx_v_
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("values");
- /* "mill/workspace.pyx":58
+ /* "mill/workspace.pyx":62
*
* def values(self):
* return self.collections.values() # <<<<<<<<<<<<<<
@@ -910,12 +920,12 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_4values(PyObject *__pyx_v_
* def items(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -935,7 +945,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_4values(PyObject *__pyx_v_
return __pyx_r;
}
-/* "mill/workspace.pyx":60
+/* "mill/workspace.pyx":64
* return self.collections.values()
*
* def items(self): # <<<<<<<<<<<<<<
@@ -950,7 +960,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_5items(PyObject *__pyx_v_s
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("items");
- /* "mill/workspace.pyx":61
+ /* "mill/workspace.pyx":65
*
* def items(self):
* return self.collections.items() # <<<<<<<<<<<<<<
@@ -958,12 +968,12 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_5items(PyObject *__pyx_v_s
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -1037,7 +1047,7 @@ static int __pyx_pf_4mill_9workspace_9Workspace_4path_2__del__(PyObject *__pyx_v
return __pyx_r;
}
-/* "mill/workspace.pyx":64
+/* "mill/workspace.pyx":68
*
*
* def workspace(path): # <<<<<<<<<<<<<<
@@ -1054,19 +1064,19 @@ static PyObject *__pyx_pf_4mill_9workspace_workspace(PyObject *__pyx_self, PyObj
__Pyx_RefNannySetupContext("workspace");
__pyx_self = __pyx_self;
- /* "mill/workspace.pyx":65
+ /* "mill/workspace.pyx":69
*
* def workspace(path):
* return Workspace(path) # <<<<<<<<<<<<<<
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_INCREF(__pyx_v_path);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
__Pyx_GIVEREF(__pyx_v_path);
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4mill_9workspace_Workspace)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4mill_9workspace_Workspace)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -1358,7 +1368,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -1484,16 +1494,16 @@ PyMODINIT_FUNC PyInit_workspace(void)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "mill/workspace.pyx":64
+ /* "mill/workspace.pyx":68
*
*
* def workspace(path): # <<<<<<<<<<<<<<
* return Workspace(path)
*
*/
- __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4mill_9workspace_workspace, NULL, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4mill_9workspace_workspace, NULL, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__workspace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__workspace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "mill/workspace.pyx":1
View
6 src/mill/workspace.pyx
@@ -27,8 +27,12 @@ cdef class Workspace:
# start session
cogr_ds = ograpi.OGROpen(self.path, 0, NULL)
+
+ # Silence null pointer errors if there are no layers
+ # At some point this should be changed to a custom handler
+ ograpi.CPLSetErrorHandler(ograpi.CPLQuietErrorHandler)
- n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
+ n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
for i in range(n):
cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i)
cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer)
Please sign in to comment.
Something went wrong with that request. Please try again.