Menu

#42 meaningless traceback spam loadPlugins function

Next Minor Release
open
nobody
None
1
2020-06-05
2020-06-05
Anonymous
No

I recently switched to a newer version of yapsy (1.2.0 via the python3-yapsy debian in Ubuntu 20.04) and noticed a large amount of tracebacks in my logs when running my yapsy plugin manager. Ex

2020-06-05 17:34:06,245 - yapsy - DEBUG - correct subclass tests failed for: get_name_of_constant in /rest_v2/src/nimbus_tester/plugins/strategy_manager_goal/strategy_manager_goal
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/yapsy/PluginManager.py", line 527, in loadPlugins
is_correct_subclass = issubclass(element, self.categories_interfaces[category_name])
TypeError: issubclass() arg 1 must be a class

This is due to the addition of the following line
logger.debug("correct subclass tests failed for: %s in %s" % (element_name, candidate_filepath), exc_info=exc_info)
in the PluginManagers loadPlugins function. I think that yapsy should filter the elemnt list for classes before calling issubclass on it to precent these messages. They are confusing and don't indicate an actual issue.

Something like this instead

import inspect

try:
    if inspect.isclass(element):
        is_correct_subclass = issubclass(element, self.categories_interfaces[category_name])
    else:
         continue
    except Exception:
        exc_info = sys.exc_info()
        log.debug("correct subclass tests failed for: %s in %s" % (element_name, candidate_filepath), exc_info=exc_info)
         continue

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB