From: Michael Tremer Date: Thu, 1 Feb 2018 13:39:27 +0000 (+0000) Subject: python: Raise proper error when database does not exist X-Git-Tag: 0.9.0~75 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=774eea26e6218a0dad2f66400f1340156389ecae python: Raise proper error when database does not exist Signed-off-by: Michael Tremer --- diff --git a/src/python/database.c b/src/python/database.c index 3c9e024..739d7a4 100644 --- a/src/python/database.c +++ b/src/python/database.c @@ -50,8 +50,10 @@ static int Database_init(DatabaseObject* self, PyObject* args, PyObject* kwargs) // Open the file for reading FILE* f = fopen(self->path, "r"); - if (!f) + if (!f) { + PyErr_SetFromErrno(PyExc_IOError); return -1; + } // Load the database int r = loc_database_new(loc_ctx, &self->db, f);