From: Uwe Hermann Date: Fri, 31 Mar 2017 17:18:19 +0000 (+0200) Subject: Don't show a harmless/confusing warning on stdout. X-Git-Tag: libsigrokdecode-0.5.0~49 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e51475add18d4a6ee4e30c4c5891b6de64c7c148;p=libsigrokdecode.git Don't show a harmless/confusing warning on stdout. Some Python versions will lead to the following message on stdout currently: srd: Attribute Error: Failed to load decoder common: no 'Decoder' \ attribute in imported module: 'module' object has no attribute 'Decoder' This is a harmless (though confusing for users) warning, since "common" is not an actual PD and it shouldn't be loaded as PD (it just has to be present). --- diff --git a/decoder.c b/decoder.c index 83b758f..9990e29 100644 --- a/decoder.c +++ b/decoder.c @@ -767,8 +767,11 @@ SRD_API int srd_decoder_load(const char *module_name) return SRD_OK; except_out: - srd_exception_catch("Failed to load decoder %s: %s", - module_name, fail_txt); + /* Don't show a message for the "common" directory, it's not a PD. */ + if (strcmp(module_name, "common")) { + srd_exception_catch("Failed to load decoder %s: %s", + module_name, fail_txt); + } fail_txt = NULL; err_out: if (fail_txt)