summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEva Schlinger <eschling@andrew.cmu.edu>2013-06-07 14:14:34 -0400
committerEva Schlinger <eschling@andrew.cmu.edu>2013-06-07 14:14:34 -0400
commite6bc1c6863f507a792307b42fa301d8f93d8c33f (patch)
tree6dcbabaefe7cc8764c1469184ebd535f48bdd3cb
parentb65255117783a902b58d212e313279e7ab536b93 (diff)
don't try to send graph in email if matplotlib import failed
-rwxr-xr-xtraining/mira/mira.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/training/mira/mira.py b/training/mira/mira.py
index 89822d41..f031c313 100755
--- a/training/mira/mira.py
+++ b/training/mira/mira.py
@@ -271,8 +271,10 @@ def write_report(graph_file, dev_results, dev_bleu,
out.close()
if args.email:
- email_process = subprocess.Popen(['mail', '-s', subject, '-a',
- graph_file, args.email], stdin = subprocess.PIPE)
+ cmd = ['mail', '-s', subject]
+ if graph_file:
+ cmd += ['-a', graph_file]
+ email_process = subprocess.Popen(cmd+[args.email], stdin = subprocess.PIPE)
email_process.communicate(message)
#feature weights stats for report