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.

local variable 'type_overall_status' referenced before assignment

See original GitHub issue

I’m using 0.9.0 but this seems to be an issue in the repo too. I’m just using this project for the first time, so I suspect I have something else wrong, but there’s a variable that’s assigned with in an if elif which makes it possible to be undefined. The line that throws the exception is: https://github.com/mwarkentin/django-watchman/blob/master/watchman/views.py#L134

From the comments and a presentation I watched, it seems that the stacktrace should be a string, but the code seems to be checking for either a dict or a list.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
tisdallcommented, Jun 10, 2019

well, if you’re interested in examples… here’s my finished checks for rabbitmq and celery:

from django.conf import settings
from watchman.decorators import check
from kombu import Connection
from celery.task.control import inspect


def better_check(func):
    def wrapped(*args, **kwargs):
        response = check(func)(*args, **kwargs)
        return {func.__name__: response}
    return wrapped

@better_check
def rabbitmq_connection_check():
    connection = Connection(settings.BROKER_URL)
    connection.connect()  # will throw an exception if can't connect
    is_connected = connection.connected
    connection.release()
    if not is_connected:
        raise Exception('rabbitmq could not be connected to')
    return {'ok': True}

@better_check
def celery_worker_check():
    insp = inspect()
    d = insp.stats()
    if not d:
        raise Exception('No running celery workers were found')
    return {'ok': True}
0reactions
stale[bot]commented, Jan 30, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Local (?) variable referenced before assignment [duplicate]
I am receiving the following error: UnboundLocalError: local variable 'test1' referenced before assignment. Error says that 'test1' is local variable but i ...
Read more >
Python local variable referenced before assignment Solution
The UnboundLocalError: local variable referenced before assignment error is raised when you try to assign a value to a local variable before it ......
Read more >
Local variable referenced before assignment in Python
The Python UnboundLocalError: Local variable referenced before assignment occurs when we reference a local variable before assigning a value to it in a ......
Read more >
Local Variable Referenced Before Assignment - STechies
The “local variable referenced before assignment” error occurs when you give reference of a local variable without assigning any value. Example:
Read more >
[SOLVED] Local Variable Referenced Before Assignment
Unboundlocalerror : local variable referenced before assignment is thrown if a variable is assigned before it's bound.
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