AttributeError in Python 3.6: 'float' object has no attribute 'items'

Asked 2 years ago, Updated 2 years ago, 103 views

We are currently using the Django framework to launch the server.
However, since yesterday, the following error has occurred:

File"/usr/local/lib/python 3.6/site-packages/redis/_compat.py", line 123, interitems
    returniter(x.items())
AttributeError: 'float' object has no attribute' items'

I don't know what the problem is and how to solve it.
Please let me know if you know how to deal with it or if you can imagine it.
Thank you for your cooperation.

The environment is as follows:
Python: 3.6
Django: 2.0.1
redis: 2.0

Here are all the logs.

*******@ubuntu:~/*******/abcdefghijk$docker logs-f*************
/usr/local/lib/python 3.6/site-packages/cely/platforms.py:796: RuntimeWarning: You're running the worker with superuser privileges: this is
absolutely not recommended!

Please specify a different user using the --uid option.

User information: uid=0 euid=0 gid=0 egid=0

  uid=uid, euid=euid, gid=gid, egid=egid,
[2018-12-06 18:52:48,932: CRITICAL/MainProcess] Unrecoverable error: AttributeError("'float' object has no attribute 'items'", )
Traceback (most recent call last):
  File"/usr/local/lib/python 3.6/site-packages/cely/worker/worker.py", line 205, install
    self.blueprint.start(self)
  File"/usr/local/lib/python 3.6/site-packages/cely/bootsteps.py", line 119, install
    step.start(parent)
  File"/usr/local/lib/python 3.6/site-packages/cely/bootsteps.py", line 369, install
    return self.obj.start()
  File"/usr/local/lib/python 3.6/site-packages/cely/worker/consumer/consumer.py", line 322, in start
    blueprint.start(self)
  File"/usr/local/lib/python 3.6/site-packages/cely/bootsteps.py", line 119, install
    step.start(parent)
  File"/usr/local/lib/python 3.6/site-packages/cely/worker/consumer/consumer.py", line 598, in start
    c.loop(*c.loop_args())
  File"/usr/local/lib/python 3.6/site-packages/cely/worker/loops.py", line 91, in asynloop
    next(loop)
  File"/usr/local/lib/python 3.6/site-packages/kombu/asynchronous/hub.py", line 354, create_loop
    cb(*cbargs)
  File"/usr/local/lib/python 3.6/site-packages/kombu/transport/redis.py", line 1040, in on_readable
    self.cycle.on_readable (fileno)
  File"/usr/local/lib/python 3.6/site-packages/kombu/transport/redis.py", line 337, in on_readable
    chan.handlers [type]()
  File"/usr/local/lib/python 3.6/site-packages/kombu/transport/redis.py", line 724, in_brpop_read
    self.connection._deliver(loads(bytes_to_str(item))), dest)
  File"/usr/local/lib/python 3.6/site-packages/kombu/transport/virtual/base.py", line 983, in_deliver
    callback (message)
  File"/usr/local/lib/python 3.6/site-packages/kombu/transport/virtual/base.py", line 632, in_callback
    self.qos.append(message,message.delivery_tag)
  File"/usr/local/lib/python 3.6/site-packages/kombu/transport/redis.py", line 149, inappend
    pipe.zadd(self.unacked_index_key, time(), delivery_tag)\
  File"/usr/local/lib/python 3.6/site-packages/redis/client.py", line 2263, in zadd
    for pair interitems (mapping):
  File"/usr/local/lib/python 3.6/site-packages/redis/_compat.py", line 123, interitems
    returniter(x.items())
AttributeError: 'float' object has no attribute' items'

 -------------- celery@92783ffb867f v4.2.0rc4 (windowlicker)
---- **** ----- 
---  ***--Linux-4.4.0-112-generic-x86_64-with-debian-9.4 2018-12-06 18:34:29
--  - *** --- 
- **----------- [config]
- **----------.>app:********:0x7f85fb0d56d8
- **--------------------- transport:redis://redis:6379/0
- **----------.>results:     
- **---.>concurrent:4(prefork)
-- ******** ----.>task events: OFF (enable-E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .>default exchange=default(direct)key=default

python python3 django redis

2022-09-29 22:41

2 Answers

At the beginning of the log, there is a name for celery, but Python, celery and redis are asynchronous tasks.Why don't you focus on debugging task schedules and task scripts?

Considering the content of the error, a common failure can be to remove the parentheses because there was only one minor score, or to forget that a tuple requires a comma at the end.If the error started yesterday, did you correct Celery's task schedule before that?Or have there been any changes to the data?

If you don't know, the bug is in an unexpected place, so please keep testing it.


2022-09-29 22:41

I think that you have applied some sort of array method (loop, etc.) to the elements of the array, not the array.Please check the shape of the array.The error appears to be occurring in the this code.Currently, I can only understand the last part of the stack trace, so I think it will be difficult to understand more details unless you copy and paste all the error messages.


2022-09-29 22:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.