How to fix "ImportError: No module named argparse" exception in abrt-action-notify and abrt-action-generate-machine-id

Solution Unverified - Updated

Environment

  • Red Hat Enterprise Linux 6
  • ABRT

Issue

ABRT sends dozens of emails about the crash in abrt-action-generate-machine-id and fills the system logs with messages like these:

abrt: detected unhandled Python exception in '/usr/libexec/abrt-action-generate-machine-id'
abrt-server[18907]: Saved Python crash dump of pid 18906 to /var/spool/abrt/pyhook-2015-07-23-08:43:33-18906
abrtd: Directory 'pyhook-2015-07-23-08:43:33-18906' creation detected
abrtd: Duplicate: core backtrace
abrtd: DUP_OF_DIR: /var/spool/abrt/pyhook-2015-07-23-08:43:33-18906
abrtd: Deleting problem directory pyhook-2015-07-23-08:43:22-18675 (dup of pyhook-2015-07-23-08:43:33-18906)
abrtd: Sending an email...
abrtd: Email was sent to: root@localhost
abrtd: Duplicate: core backtrace
abrtd: DUP_OF_DIR: /var/spool/abrt/pyhook-2015-07-23-03:59:32-5493
abrtd: Deleting problem directory pyhook-2015-07-23-08:43:22-18687 (dup of pyhook-2015-07-23-03:59:32-5493)
abrt: detected unhandled Python exception in '/usr/bin/abrt-action-notify'
abrt-server[18918]: Saved Python crash dump of pid 18917 to /var/spool/abrt/pyhook-2015-07-23-08:43:34-18917
abrtd: Directory 'pyhook-2015-07-23-08:43:34-18917' creation detected
abrtd: Traceback (most recent call last):
abrtd:   File "/usr/bin/abrt-action-notify", line 18, in <module>
abrtd:     from argparse import ArgumentParser
abrtd: ImportError: No module named argparse

Resolution

This issue was resolved with the release of Errata RHBA-2016-0920.
To resolve the issue, update to abrt-2.0.8-40.el6 or higher.

Root Cause

  • Both abrt-action-notify and abrt-action-generate-machine-id import the Python module argparse which is not included in Python itself but by the package python-argparse which also, is not included by default.
  • abrt package missed the dependency for this package so it's not being installed causing it to report this error in case no other package had it installed.

Diagnostic Steps

  • verify that python-argparse is installed:

    rpm -q python-argparse
    
SBR
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.