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.

Not enough values to unpack (expected 2, got 1)

See original GitHub issue

Hello! I faced with this problem when I try to run command python manage.py qcluster:

[Q] INFO Q Cluster-21177 starting.
[Q] INFO Process-1:1 ready for work at 21181
[Q] INFO Process-1:2 ready for work at 21182
[Q] INFO Process-1:3 ready for work at 21183
[Q] INFO Process-1:4 ready for work at 21184
[Q] INFO Process-1:5 monitoring at 21185
[Q] INFO Process-1 guarding cluster at 21180
[Q] INFO Process-1:6 pushing tasks at 21186
[Q] INFO Q Cluster-21177 running.
[Q] INFO Enqueued 2
[Q] INFO Process-1 created a task from schedule [check_achievements_monthly]
[Q] INFO Process-1:1 processing [two-nineteen-may-pasta]
[Q] ERROR Failed [two-nineteen-may-pasta] - not enough values to unpack (expected 2, got 1)

I use Python 3.7, Django 2.0.7

from datetime import datetime
from django.contrib.auth.models import User
from django_q.tasks import schedule
from pytz import timezone

from achievements.models import Achievement, UserAchievement


def check_ach(*args, **kwargs):
    for achievement in Achievement.objects.filter(period=args[0]):
        for user in User.objects.all():
            try:
                user_achievement = achievement.users_achievements.get(user=user)
            except UserAchievement.DoesNotExist:
                user_achievement = None

            if user_achievement and user_achievement.max_amount_reached:
                continue  # user already has maximal amount of that achievement - skip

            if achievement.is_earned(user):
                UserAchievement.objects.create(achievement=achievement, user=user)


schedule(check_ach,'MONTHLY', name='check_achievements_monthly', schedule_type='M', next_run=datetime.now().astimezone(timezone('Europe/Kiev')))

Can you help me with this issue?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:7

github_iconTop GitHub Comments

4reactions
GodMode-Oncommented, Sep 10, 2019

@mm-matthias @bronte2k7 @nastyaDjo I fixed it: in task pass not function instance, but path to it as str. For example: 'users.emails.send_email_message' instead of send_email_message

1reaction
mm-matthiascommented, Jan 9, 2019

I see this issue when requeing a failed task via the admin panel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python - How to fix “ValueError: not enough values to unpack ...
Python - How to fix “ValueError: not enough values to unpack (expected 2, got 1)” [closed] ; 1. Kindly add script which invokes...
Read more >
ValueError: not enough values to unpack (expected 2, got 1)
During a multiple value assignment, the ValueError: not enough values to unpack occurs when either you have fewer objects to assign than variables,...
Read more >
ValueError: not enough values to unpack (expected 2, got 1)
ValueError: not enough values to unpack ( expected 2, got 1 ) || Value Error in Python The Python ValueError is an exception...
Read more >
Related error not enough values to unpack (expected 2, got 1)
This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error ......
Read more >
ValueError: not enough values to unpack (expected 2, got 1 ...
Hi. I was trying to use the EqOddsPostprocessing algorithm and I received the error referenced when calling the predict method. Going into this,...
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