question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'NoneType' object has no attribute '__module__'

See original GitHub issue

We are getting a Sentry issue reported by Sentry. The issue happens in Celery executed code.

MESSAGE

Signal handler <bound method SentryCeleryHandler.process_failure_signal of <raven.contrib.celery.SentryCeleryHandler object at 0x7f7ba702e450>> raised: AttributeError("'NoneType' object has no attribute '__module__'",)

Exception: AttributeError 'NoneType' object has no attribute '__module__'

The offending code looks to be this: def should_capture(self, exc_info): exc_type = exc_info[0] exc_name = '%s.%s' % (exc_type.__module__, exc_type.__name__) exclusions = self.ignore_exceptions

Python: 2.7.11 raven-python: 5.32.0 celery: 4.0.2

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

4reactions
blairg23commented, Jun 19, 2018

I only got this problem when I tried to use client.captureException outside of a try/except block.

1reaction
sorratcommented, Jul 4, 2018

Sort of workaround for using captureException outside try/except block:

import sys

import raven


def get_exc_info():
    exc_info = sys.exc_info()
    if exc_info[0] is None:
        return None
    return exc_info


def capture_exception(error)
    sentry = raven.Client(...)
    exc_info = get_exc_info()
    if exc_info:
        sentry.captureException(exc_info)
    else:
        sentry.captureMessage(error)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get AttributeError: 'NoneType' object has no attribute ...
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None .
Read more >
AttributeError: 'NoneType' object has no attribute ... - GitHub
In my case the problem was caused by adding a module directory to sys path and using import directory.module . Using import module...
Read more >
[FIXED] AttributeError: 'NoneType' object has no attribute ...
The code encounters an attribute error because in the first iteration it cannot find a match, therefore x returns None. Hence, when we...
Read more >
'NoneType' Object has no Attribute 'modules' Attri...
I am developing a script tool that will be part of a suite of tools in an ArcToolbox. This script tool is intended...
Read more >
AttributeError: 'NoneType' object has no attribute 'ema_scope'
AttributeError : 'NoneType' object has no attribute 'ema_scope'. I have the Automatic1111 webui do a git pull everytime I run it. It ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found