Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
3  src/mill/collection.c
... ... @@ -1,4 +1,4 @@
1   -/* Generated by Cython 0.14.1 on Thu Aug 4 10:44:36 2011 */
  1 +/* Generated by Cython 0.14.1 on Thu Aug 4 11:15:14 2011 */
2 2
3 3 #define PY_SSIZE_T_CLEAN
4 4 #include "Python.h"
@@ -221,6 +221,7 @@
221 221 #include <math.h>
222 222 #define __PYX_HAVE_API__mill__collection
223 223 #include "ogr_api.h"
  224 +#include "cpl_error.h"
224 225
225 226 #ifdef PYREX_WITHOUT_ASSERTIONS
226 227 #define CYTHON_WITHOUT_ASSERTIONS
3  src/mill/ograpi.pxd
@@ -35,3 +35,6 @@ cdef extern from "ogr_api.h":
35 35 void * OGROpenShared (char *path, int mode, void *x)
36 36 int OGRReleaseDataSource (void *datasource)
37 37
  38 +cdef extern from "cpl_error.h":
  39 + void CPLSetErrorHandler (void *handler)
  40 + void * CPLQuietErrorHandler
2  src/mill/ogrinit.c
... ... @@ -1,4 +1,4 @@
1   -/* Generated by Cython 0.14.1 on Thu Aug 4 10:44:36 2011 */
  1 +/* Generated by Cython 0.14.1 on Thu Aug 4 11:15:14 2011 */
2 2
3 3 #define PY_SSIZE_T_CLEAN
4 4 #include "Python.h"
118 src/mill/workspace.c
... ... @@ -1,4 +1,4 @@
1   -/* Generated by Cython 0.14.1 on Thu Aug 4 10:44:37 2011 */
  1 +/* Generated by Cython 0.14.1 on Thu Aug 4 11:15:15 2011 */
2 2
3 3 #define PY_SSIZE_T_CLEAN
4 4 #include "Python.h"
@@ -221,6 +221,7 @@
221 221 #include <math.h>
222 222 #define __PYX_HAVE_API__mill__workspace
223 223 #include "ogr_api.h"
  224 +#include "cpl_error.h"
224 225
225 226 #ifdef PYREX_WITHOUT_ASSERTIONS
226 227 #define CYTHON_WITHOUT_ASSERTIONS
@@ -580,13 +581,22 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
580 581 * # start session
581 582 * cogr_ds = ograpi.OGROpen(self.path, 0, NULL) # <<<<<<<<<<<<<<
582 583 *
583   - * n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
  584 + * # Silence null pointer errors if there are no layers
584 585 */
585 586 __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;}
586 587 __pyx_v_cogr_ds = OGROpen(__pyx_t_2, 0, NULL);
587 588
588   - /* "mill/workspace.pyx":31
589   - * cogr_ds = ograpi.OGROpen(self.path, 0, NULL)
  589 + /* "mill/workspace.pyx":33
  590 + * # Silence null pointer errors if there are no layers
  591 + * # At some point this should be changed to a custom handler
  592 + * ograpi.CPLSetErrorHandler(ograpi.CPLQuietErrorHandler) # <<<<<<<<<<<<<<
  593 + *
  594 + * n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
  595 + */
  596 + CPLSetErrorHandler(CPLQuietErrorHandler);
  597 +
  598 + /* "mill/workspace.pyx":35
  599 + * ograpi.CPLSetErrorHandler(ograpi.CPLQuietErrorHandler)
590 600 *
591 601 * n = ograpi.OGR_DS_GetLayerCount(cogr_ds) # <<<<<<<<<<<<<<
592 602 * for i in range(n):
@@ -594,7 +604,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
594 604 */
595 605 __pyx_v_n = OGR_DS_GetLayerCount(__pyx_v_cogr_ds);
596 606
597   - /* "mill/workspace.pyx":32
  607 + /* "mill/workspace.pyx":36
598 608 *
599 609 * n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
600 610 * for i in range(n): # <<<<<<<<<<<<<<
@@ -605,7 +615,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
605 615 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
606 616 __pyx_v_i = __pyx_t_4;
607 617
608   - /* "mill/workspace.pyx":33
  618 + /* "mill/workspace.pyx":37
609 619 * n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
610 620 * for i in range(n):
611 621 * cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i) # <<<<<<<<<<<<<<
@@ -614,7 +624,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
614 624 */
615 625 __pyx_v_cogr_layer = OGR_DS_GetLayer(__pyx_v_cogr_ds, __pyx_v_i);
616 626
617   - /* "mill/workspace.pyx":34
  627 + /* "mill/workspace.pyx":38
618 628 * for i in range(n):
619 629 * cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i)
620 630 * cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer) # <<<<<<<<<<<<<<
@@ -623,7 +633,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
623 633 */
624 634 __pyx_v_cogr_layerdefn = OGR_L_GetLayerDefn(__pyx_v_cogr_layer);
625 635
626   - /* "mill/workspace.pyx":35
  636 + /* "mill/workspace.pyx":39
627 637 * cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i)
628 638 * cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer)
629 639 * layer_name = ograpi.OGR_FD_GetName(cogr_layerdefn) # <<<<<<<<<<<<<<
@@ -632,18 +642,18 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
632 642 */
633 643 __pyx_v_layer_name = OGR_FD_GetName(__pyx_v_cogr_layerdefn);
634 644
635   - /* "mill/workspace.pyx":36
  645 + /* "mill/workspace.pyx":40
636 646 * cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer)
637 647 * layer_name = ograpi.OGR_FD_GetName(cogr_layerdefn)
638 648 * collection = Collection(layer_name, self) # <<<<<<<<<<<<<<
639 649 * collections[layer_name] = collection
640 650 *
641 651 */
642   - __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;}
  652 + __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;}
643 653 __Pyx_GOTREF(__pyx_t_1);
644   - __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;}
  654 + __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;}
645 655 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
646   - __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;}
  656 + __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;}
647 657 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
648 658 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
649 659 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
@@ -651,7 +661,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
651 661 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self);
652 662 __Pyx_GIVEREF(__pyx_v_self);
653 663 __pyx_t_5 = 0;
654   - __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;}
  664 + __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;}
655 665 __Pyx_GOTREF(__pyx_t_5);
656 666 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
657 667 __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
659 669 __pyx_v_collection = __pyx_t_5;
660 670 __pyx_t_5 = 0;
661 671
662   - /* "mill/workspace.pyx":37
  672 + /* "mill/workspace.pyx":41
663 673 * layer_name = ograpi.OGR_FD_GetName(cogr_layerdefn)
664 674 * collection = Collection(layer_name, self)
665 675 * collections[layer_name] = collection # <<<<<<<<<<<<<<
666 676 *
667 677 * # end session
668 678 */
669   - __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;}
  679 + __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;}
670 680 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
671   - 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;}
  681 + 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;}
672 682 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
673 683 }
674 684
675   - /* "mill/workspace.pyx":40
  685 + /* "mill/workspace.pyx":44
676 686 *
677 687 * # end session
678 688 * ograpi.OGR_DS_Destroy(cogr_ds) # <<<<<<<<<<<<<<
@@ -681,7 +691,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
681 691 */
682 692 OGR_DS_Destroy(__pyx_v_cogr_ds);
683 693
684   - /* "mill/workspace.pyx":42
  694 + /* "mill/workspace.pyx":46
685 695 * ograpi.OGR_DS_Destroy(cogr_ds)
686 696 *
687 697 * return collections # <<<<<<<<<<<<<<
@@ -709,7 +719,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_1_read_collections(PyObjec
709 719 return __pyx_r;
710 720 }
711 721
712   -/* "mill/workspace.pyx":46
  722 +/* "mill/workspace.pyx":50
713 723 * property collections:
714 724 * # A lazy property
715 725 * def __get__(self): # <<<<<<<<<<<<<<
@@ -726,27 +736,27 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_11collections___get__(PyOb
726 736 PyObject *__pyx_t_4 = NULL;
727 737 __Pyx_RefNannySetupContext("__get__");
728 738
729   - /* "mill/workspace.pyx":47
  739 + /* "mill/workspace.pyx":51
730 740 * # A lazy property
731 741 * def __get__(self):
732 742 * if not self._collections: # <<<<<<<<<<<<<<
733 743 * self._collections = self._read_collections()
734 744 * return self._collections
735 745 */
736   - __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;}
  746 + __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;}
737 747 __pyx_t_2 = (!__pyx_t_1);
738 748 if (__pyx_t_2) {
739 749
740   - /* "mill/workspace.pyx":48
  750 + /* "mill/workspace.pyx":52
741 751 * def __get__(self):
742 752 * if not self._collections:
743 753 * self._collections = self._read_collections() # <<<<<<<<<<<<<<
744 754 * return self._collections
745 755 *
746 756 */
747   - __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;}
  757 + __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;}
748 758 __Pyx_GOTREF(__pyx_t_3);
749   - __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;}
  759 + __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;}
750 760 __Pyx_GOTREF(__pyx_t_4);
751 761 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
752 762 __Pyx_GIVEREF(__pyx_t_4);
@@ -758,7 +768,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_11collections___get__(PyOb
758 768 }
759 769 __pyx_L5:;
760 770
761   - /* "mill/workspace.pyx":49
  771 + /* "mill/workspace.pyx":53
762 772 * if not self._collections:
763 773 * self._collections = self._read_collections()
764 774 * return self._collections # <<<<<<<<<<<<<<
@@ -783,7 +793,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_11collections___get__(PyOb
783 793 return __pyx_r;
784 794 }
785 795
786   -/* "mill/workspace.pyx":51
  796 +/* "mill/workspace.pyx":55
787 797 * return self._collections
788 798 *
789 799 * def __getitem__(self, name): # <<<<<<<<<<<<<<
@@ -799,7 +809,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_2__getitem__(PyObject *__p
799 809 PyObject *__pyx_t_3 = NULL;
800 810 __Pyx_RefNannySetupContext("__getitem__");
801 811
802   - /* "mill/workspace.pyx":52
  812 + /* "mill/workspace.pyx":56
803 813 *
804 814 * def __getitem__(self, name):
805 815 * return self.collections.__getitem__(name) # <<<<<<<<<<<<<<
@@ -807,17 +817,17 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_2__getitem__(PyObject *__p
807 817 * def keys(self):
808 818 */
809 819 __Pyx_XDECREF(__pyx_r);
810   - __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;}
  820 + __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;}
811 821 __Pyx_GOTREF(__pyx_t_1);
812   - __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;}
  822 + __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;}
813 823 __Pyx_GOTREF(__pyx_t_2);
814 824 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
815   - __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;}
  825 + __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;}
816 826 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
817 827 __Pyx_INCREF(__pyx_v_name);
818 828 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name);
819 829 __Pyx_GIVEREF(__pyx_v_name);
820   - __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;}
  830 + __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;}
821 831 __Pyx_GOTREF(__pyx_t_3);
822 832 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
823 833 __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
839 849 return __pyx_r;
840 850 }
841 851
842   -/* "mill/workspace.pyx":54
  852 +/* "mill/workspace.pyx":58
843 853 * return self.collections.__getitem__(name)
844 854 *
845 855 * def keys(self): # <<<<<<<<<<<<<<
@@ -854,7 +864,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_3keys(PyObject *__pyx_v_se
854 864 PyObject *__pyx_t_2 = NULL;
855 865 __Pyx_RefNannySetupContext("keys");
856 866
857   - /* "mill/workspace.pyx":55
  867 + /* "mill/workspace.pyx":59
858 868 *
859 869 * def keys(self):
860 870 * return self.collections.keys() # <<<<<<<<<<<<<<
@@ -862,12 +872,12 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_3keys(PyObject *__pyx_v_se
862 872 * def values(self):
863 873 */
864 874 __Pyx_XDECREF(__pyx_r);
865   - __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;}
  875 + __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;}
866 876 __Pyx_GOTREF(__pyx_t_1);
867   - __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;}
  877 + __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;}
868 878 __Pyx_GOTREF(__pyx_t_2);
869 879 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
870   - __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;}
  880 + __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;}
871 881 __Pyx_GOTREF(__pyx_t_1);
872 882 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
873 883 __pyx_r = __pyx_t_1;
@@ -887,7 +897,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_3keys(PyObject *__pyx_v_se
887 897 return __pyx_r;
888 898 }
889 899
890   -/* "mill/workspace.pyx":57
  900 +/* "mill/workspace.pyx":61
891 901 * return self.collections.keys()
892 902 *
893 903 * def values(self): # <<<<<<<<<<<<<<
@@ -902,7 +912,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_4values(PyObject *__pyx_v_
902 912 PyObject *__pyx_t_2 = NULL;
903 913 __Pyx_RefNannySetupContext("values");
904 914
905   - /* "mill/workspace.pyx":58
  915 + /* "mill/workspace.pyx":62
906 916 *
907 917 * def values(self):
908 918 * return self.collections.values() # <<<<<<<<<<<<<<
@@ -910,12 +920,12 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_4values(PyObject *__pyx_v_
910 920 * def items(self):
911 921 */
912 922 __Pyx_XDECREF(__pyx_r);
913   - __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;}
  923 + __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;}
914 924 __Pyx_GOTREF(__pyx_t_1);
915   - __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;}
  925 + __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;}
916 926 __Pyx_GOTREF(__pyx_t_2);
917 927 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
918   - __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;}
  928 + __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;}
919 929 __Pyx_GOTREF(__pyx_t_1);
920 930 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
921 931 __pyx_r = __pyx_t_1;
@@ -935,7 +945,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_4values(PyObject *__pyx_v_
935 945 return __pyx_r;
936 946 }
937 947
938   -/* "mill/workspace.pyx":60
  948 +/* "mill/workspace.pyx":64
939 949 * return self.collections.values()
940 950 *
941 951 * def items(self): # <<<<<<<<<<<<<<
@@ -950,7 +960,7 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_5items(PyObject *__pyx_v_s
950 960 PyObject *__pyx_t_2 = NULL;
951 961 __Pyx_RefNannySetupContext("items");
952 962
953   - /* "mill/workspace.pyx":61
  963 + /* "mill/workspace.pyx":65
954 964 *
955 965 * def items(self):
956 966 * return self.collections.items() # <<<<<<<<<<<<<<
@@ -958,12 +968,12 @@ static PyObject *__pyx_pf_4mill_9workspace_9Workspace_5items(PyObject *__pyx_v_s
958 968 *
959 969 */
960 970 __Pyx_XDECREF(__pyx_r);
961   - __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;}
  971 + __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;}
962 972 __Pyx_GOTREF(__pyx_t_1);
963   - __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;}
  973 + __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;}
964 974 __Pyx_GOTREF(__pyx_t_2);
965 975 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
966   - __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;}
  976 + __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;}
967 977 __Pyx_GOTREF(__pyx_t_1);
968 978 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
969 979 __pyx_r = __pyx_t_1;
@@ -1037,7 +1047,7 @@ static int __pyx_pf_4mill_9workspace_9Workspace_4path_2__del__(PyObject *__pyx_v
1037 1047 return __pyx_r;
1038 1048 }
1039 1049
1040   -/* "mill/workspace.pyx":64
  1050 +/* "mill/workspace.pyx":68
1041 1051 *
1042 1052 *
1043 1053 * def workspace(path): # <<<<<<<<<<<<<<
@@ -1054,19 +1064,19 @@ static PyObject *__pyx_pf_4mill_9workspace_workspace(PyObject *__pyx_self, PyObj
1054 1064 __Pyx_RefNannySetupContext("workspace");
1055 1065 __pyx_self = __pyx_self;
1056 1066
1057   - /* "mill/workspace.pyx":65
  1067 + /* "mill/workspace.pyx":69
1058 1068 *
1059 1069 * def workspace(path):
1060 1070 * return Workspace(path) # <<<<<<<<<<<<<<
1061 1071 *
1062 1072 */
1063 1073 __Pyx_XDECREF(__pyx_r);
1064   - __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;}
  1074 + __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;}
1065 1075 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
1066 1076 __Pyx_INCREF(__pyx_v_path);
1067 1077 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
1068 1078 __Pyx_GIVEREF(__pyx_v_path);
1069   - __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;}
  1079 + __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;}
1070 1080 __Pyx_GOTREF(__pyx_t_2);
1071 1081 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
1072 1082 __pyx_r = __pyx_t_2;
@@ -1358,7 +1368,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
1358 1368 {0, 0, 0, 0, 0, 0, 0}
1359 1369 };
1360 1370 static int __Pyx_InitCachedBuiltins(void) {
1361   - __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;}
  1371 + __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;}
1362 1372 return 0;
1363 1373 __pyx_L1_error:;
1364 1374 return -1;
@@ -1484,16 +1494,16 @@ PyMODINIT_FUNC PyInit_workspace(void)
1484 1494 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1485 1495 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1486 1496
1487   - /* "mill/workspace.pyx":64
  1497 + /* "mill/workspace.pyx":68
1488 1498 *
1489 1499 *
1490 1500 * def workspace(path): # <<<<<<<<<<<<<<
1491 1501 * return Workspace(path)
1492 1502 *
1493 1503 */
1494   - __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;}
  1504 + __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;}
1495 1505 __Pyx_GOTREF(__pyx_t_1);
1496   - 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;}
  1506 + 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;}
1497 1507 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1498 1508
1499 1509 /* "mill/workspace.pyx":1
6 src/mill/workspace.pyx
@@ -27,8 +27,12 @@ cdef class Workspace:
27 27
28 28 # start session
29 29 cogr_ds = ograpi.OGROpen(self.path, 0, NULL)
  30 +
  31 + # Silence null pointer errors if there are no layers
  32 + # At some point this should be changed to a custom handler
  33 + ograpi.CPLSetErrorHandler(ograpi.CPLQuietErrorHandler)
30 34
31   - n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
  35 + n = ograpi.OGR_DS_GetLayerCount(cogr_ds)
32 36 for i in range(n):
33 37 cogr_layer = ograpi.OGR_DS_GetLayer(cogr_ds, i)
34 38 cogr_layerdefn = ograpi.OGR_L_GetLayerDefn(cogr_layer)

0 comments on commit 11a3d1b

Please sign in to comment.
Something went wrong with that request. Please try again.