From f1b4e9950120224e0631bb86309590dfb661f2b1 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 13 Apr 2020 10:29:31 -0500 Subject: Format stack dump in output --- bh20simplewebuploader/main.py | 7 +++++-- bh20simplewebuploader/templates/error.html | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'bh20simplewebuploader') diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 81f2ef9..693e4fd 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -3,6 +3,7 @@ import tempfile import shutil import subprocess import os +import sys import re import string import yaml @@ -250,12 +251,14 @@ def receive_files(): error_message="You did not include metadata."), 403) # Try and upload files to Arvados using the sequence uploader CLI - result = subprocess.run(['bh20-seq-uploader', fasta_dest, metadata_dest], + + result = subprocess.run(['python3','bh20sequploader/main.py', fasta_dest, metadata_dest], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if result.returncode != 0: # It didn't work. Complain. - error_message="Upload failed. Uploader returned {} and said:\n{}".format(result.returncode, result.stderr) + error_message="Uploader returned value {} and said:".format(result.returncode) + str(result.stderr.decode('utf-8')) + print(error_message, file=sys.stderr) return (render_template('error.html', error_message=error_message), 403) else: # It worked. Say so. diff --git a/bh20simplewebuploader/templates/error.html b/bh20simplewebuploader/templates/error.html index c2ab0a4..b1d9402 100644 --- a/bh20simplewebuploader/templates/error.html +++ b/bh20simplewebuploader/templates/error.html @@ -9,7 +9,10 @@

Upload Failed


- Your upload has failed. {{error_message}} + Your upload has failed. +

+            {{error_message|safe}}
+          

Click here to try again. -- cgit v1.2.3