diff options
-rw-r--r-- | mscp/mscp.py | 3 | ||||
-rw-r--r-- | src/mscp.c | 3 | ||||
-rw-r--r-- | src/pymscp.c | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/mscp/mscp.py b/mscp/mscp.py index 04a7b89..97f3cb1 100644 --- a/mscp/mscp.py +++ b/mscp/mscp.py @@ -71,6 +71,9 @@ class mscp: self.state = STATE_INIT def __str__(self): + if not hasattr(self, "state"): + # this instance failed on mscp_init + return "mscp:{}:init-failed" return "mscp:{}:{}".format(self.remote, self.__state2str()) def __repr__(self): @@ -194,6 +194,9 @@ static int validate_and_set_defaut_params(struct mscp_opts *o) if (o->max_startups == 0) o->max_startups = DEFAULT_MAX_STARTUPS; + if (o->msg_fd == 0) + o->msg_fd = STDOUT_FILENO; + return 0; } diff --git a/src/pymscp.c b/src/pymscp.c index 4c2adc7..49bc85e 100644 --- a/src/pymscp.c +++ b/src/pymscp.c @@ -175,6 +175,7 @@ static PyObject *wrap_mscp_init(PyObject *sef, PyObject *args, PyObject *kw) i->m = mscp_init(remote, direction, &i->mo, &i->so); if (!i->m) { + PyErr_Format(PyExc_RuntimeError, "%s", mscp_get_error()); free(i); return NULL; } |