Geef een interrupt bij een exception in een thread
This commit is contained in:
7
app.py
7
app.py
@@ -2,6 +2,7 @@ import os
|
||||
import time
|
||||
import sys
|
||||
import threading
|
||||
import _thread
|
||||
from dsmr_parser import telegram_specifications
|
||||
from dsmr_parser.clients import SerialReader, SERIAL_SETTINGS_V2_2, SERIAL_SETTINGS_V4, SERIAL_SETTINGS_V5
|
||||
|
||||
@@ -49,7 +50,11 @@ def main():
|
||||
|
||||
def startTimer():
|
||||
threading.Timer(cfg.dsmr_update_interval, startTimer).start()
|
||||
handle_next_telegram()
|
||||
try:
|
||||
handle_next_telegram()
|
||||
except:
|
||||
_thread.interrupt_main()
|
||||
|
||||
|
||||
startTimer()
|
||||
# for telegram in serial_reader.read_as_object():
|
||||
|
||||
Reference in New Issue
Block a user