#21 Conversion en float lorsque la variable est vide

Closed
opened 3 years ago by maxime-alves · 1 comments
[2020-09-24 13:22:24,830][ERROR][uvicorn.error][run_asgi](l.393) Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 376, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 43, in app
    response = await run_in_threadpool(func, request)
  File "/usr/local/lib/python3.7/dist-packages/starlette/concurrency.py", line 34, in run_in_threadpool
    return await loop.run_in_executor(None, func, *args)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/heatpump.py", line 17, in get_variable_values
    return JSONResponse(h.__dict__())
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 28, in __dict__
    return { **r, **self.get_var_values() }
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 38, in get_var_values
    r[label] = var_type.get_variables_values()
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable_type.py", line 59, in get_variables_values
    return Variable.getall_values_of_type(self)
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 69, in getall_values_of_type
    return Variable.getall_values_of_type_since(type, 0)
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 92, in getall_values_of_type_since
    type.__dict__)
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 80, in <dictcomp>
    for row in DB.sql(
  File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 74, in <lambda>
    floatcast = lambda x: round(float(x) / 10, 2)
TypeError: float() argument must be a string or a number, not 'NoneType'
SELECT * FROM var_type
{}
SELECT var.address as address, val.value
            FROM variable var
            LEFT JOIN var_value val ON
                var.type = val.type
                AND var.address = val.address
                AND var.last_update = val.time
            WHERE
                var.type = :slabel
                AND var.address >= :start_address
                AND var.address <= :end_address
                AND var.last_update > :since
{'slabel': 'A', 'label': 'Analog', 'type': 'float', 'start_address': 1, 'end_address': 5000, 'since': 0}
INFO:     127.0.0.1:59930 - "GET /heatpump/ HTTP/1.1" 500 Internal Server Error
``` [2020-09-24 13:22:24,830][ERROR][uvicorn.error][run_asgi](l.393) Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi result = await app(self.scope, self.receive, self.send) File "/usr/local/lib/python3.7/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__ return await self.app(scope, receive, send) File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__ await route.handle(scope, receive, send) File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 376, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__ await route.handle(scope, receive, send) File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 227, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 43, in app response = await run_in_threadpool(func, request) File "/usr/local/lib/python3.7/dist-packages/starlette/concurrency.py", line 34, in run_in_threadpool return await loop.run_in_executor(None, func, *args) File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.7/dist-packages/pyheatpump/heatpump.py", line 17, in get_variable_values return JSONResponse(h.__dict__()) File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 28, in __dict__ return { **r, **self.get_var_values() } File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 38, in get_var_values r[label] = var_type.get_variables_values() File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable_type.py", line 59, in get_variables_values return Variable.getall_values_of_type(self) File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 69, in getall_values_of_type return Variable.getall_values_of_type_since(type, 0) File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 92, in getall_values_of_type_since type.__dict__) File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 80, in <dictcomp> for row in DB.sql( File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 74, in <lambda> floatcast = lambda x: round(float(x) / 10, 2) TypeError: float() argument must be a string or a number, not 'NoneType' SELECT * FROM var_type {} SELECT var.address as address, val.value FROM variable var LEFT JOIN var_value val ON var.type = val.type AND var.address = val.address AND var.last_update = val.time WHERE var.type = :slabel AND var.address >= :start_address AND var.address <= :end_address AND var.last_update > :since {'slabel': 'A', 'label': 'Analog', 'type': 'float', 'start_address': 1, 'end_address': 5000, 'since': 0} INFO: 127.0.0.1:59930 - "GET /heatpump/ HTTP/1.1" 500 Internal Server Error ```
maxime-alves changed title from Conversion en flaot lorsque la variable est vide to Conversion en float lorsque la variable est vide 3 years ago
maxime-alves started working 3 years ago
maxime-alves self-assigned this 3 years ago
maxime-alves stopped working 3 years ago
24min 11s
maxime-alves started working 3 years ago
maxime-alves referenced this issue from a commit 3 years ago
maxime-alves referenced this issue from a commit 3 years ago
maxime-alves referenced this issue from a commit 3 years ago
maxime-alves stopped working 3 years ago
19min 40s
maxime-alves commented 3 years ago
Collaborator

Le problème semble résolu.

Le problème semble résolu.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Total Time Spent: 43min 51s
\/\/ \-/ ❭❬
43min 51s
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
Cancel
Save
There is no content yet.