Skip to content
GitLab
Explore
Sign in
Davide Ricci
software-di-controllo
Compare revisions
e9baff42293d7021fb04e347683dfd6c781ad874 to 3da50d7e5a34bfe5ea1c1a2da781e278a392aacf
Commits on Source (2)
Handling AttributeError that causes webcam stream thread crash
· b426ceb0
Davide Ricci
authored
Apr 05, 2024
and
Davide Ricci
committed
Apr 05, 2024
b426ceb0
Merge branch 'main' of
https://www.ict.inaf.it/gitlab/davide.ricci/software-di-controllo
· 3da50d7e
Davide Ricci
authored
Apr 05, 2024
3da50d7e
Hide whitespace changes
Inline
Side-by-side
web/server/stream.py
View file @
3da50d7e
...
...
@@ -54,10 +54,14 @@ def send_webcam(socketio, name, url, sleep=1):
while
True
:
socketio
.
sleep
(
sleep
)
with
app
.
test_client
()
as
client
:
res
=
client
.
get
(
url
).
get_json
()
img
=
res
[
"
response
"
].
encode
(
"
ISO-8859-1
"
)
status
.
last
[
name
]
=
bytes
(
img
)
socketio
.
emit
(
name
,
bytes
(
img
))
res
=
client
.
get
(
url
).
get_json
()
try
:
img
=
res
[
"
response
"
].
encode
(
"
ISO-8859-1
"
)
status
.
last
[
name
]
=
bytes
(
img
)
socketio
.
emit
(
name
,
bytes
(
img
))
except
AttributeError
as
e
:
console
.
warning
(
f
"
Could not send webcam image:
{
e
}
"
)
pass
def
send_log
(
socketio
,
name
,
num_lines
=
30
,
sleep
=
0.25
,
once
=
False
):
...
...