samadi10 commited on
Commit
5854914
1 Parent(s): 3fc2721

bug-fix: fixing sub-process

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -13,10 +13,13 @@ def generate_html(text_input, length):
13
  "--text", text_input,
14
  "--length", str(length)
15
  ]
16
- # Run the command
17
- subprocess.run(command, check=True)
18
- # Return the path of the latest HTML file in the output directory
19
- return find_latest_html_file('output')
 
 
 
20
 
21
  # Function to find the latest HTML file in the specified directory
22
  def find_latest_html_file(base_path):
 
13
  "--text", text_input,
14
  "--length", str(length)
15
  ]
16
+ try:
17
+ # Capture the standard error output
18
+ result = subprocess.run(command, check=True, text=True, capture_output=True)
19
+ return find_latest_html_file('output')
20
+ except subprocess.CalledProcessError as e:
21
+ print("Error:", e.stderr) # Print the error message from stderr
22
+ return None
23
 
24
  # Function to find the latest HTML file in the specified directory
25
  def find_latest_html_file(base_path):