inoki-giskard commited on
Commit
28e9187
1 Parent(s): bfb27a7

Handle the error when no log file

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -11,8 +11,11 @@ LOG_FILE = "output.log"
11
 
12
  def read_logs():
13
  sys.stdout.flush()
14
- with open(LOG_FILE, "r") as f:
15
- return f.read()
 
 
 
16
 
17
 
18
  previous_url = ""
 
11
 
12
  def read_logs():
13
  sys.stdout.flush()
14
+ try:
15
+ with open(LOG_FILE, "r") as f:
16
+ return f.read()
17
+ except Exception:
18
+ return "ML worker not running"
19
 
20
 
21
  previous_url = ""