MilesCranmer commited on
Commit
e69aea3
1 Parent(s): cc248dd

More helpful error messages

Browse files
Files changed (1) hide show
  1. gui/app.py +17 -1
gui/app.py CHANGED
@@ -4,6 +4,7 @@ import os
4
  import tempfile
5
  import numpy as np
6
  import pandas as pd
 
7
 
8
 
9
  def greet(
@@ -56,7 +57,22 @@ def greet(
56
  binary_operators=binary_operators,
57
  unary_operators=unary_operators,
58
  )
59
- model.fit(X, y)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  df = model.equations_[["equation", "loss", "complexity"]]
62
  # Convert all columns to string type:
 
4
  import tempfile
5
  import numpy as np
6
  import pandas as pd
7
+ import traceback as tb
8
 
9
 
10
  def greet(
 
57
  binary_operators=binary_operators,
58
  unary_operators=unary_operators,
59
  )
60
+ try:
61
+ model.fit(X, y)
62
+ # Catch all error:
63
+ except Exception as e:
64
+ error_traceback = tb.format_exc()
65
+ if "CalledProcessError" in error_traceback:
66
+ return (
67
+ empty_df,
68
+ "Could not initialize Julia. Error message:\n"
69
+ + error_traceback,
70
+ )
71
+ else:
72
+ return (
73
+ empty_df,
74
+ "Failed due to error:\n" + error_traceback,
75
+ )
76
 
77
  df = model.equations_[["equation", "loss", "complexity"]]
78
  # Convert all columns to string type: