Skip to content

Commit 4e2b7b1

Browse files
committed
added exception handling if can't write to glade
1 parent f03febb commit 4e2b7b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/rda_python_common/PgLOG.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,12 @@ def log_email(emlmsg):
354354
if not CPID['PID']: CPID['PID'] = "{}-{}-{}".format(PGLOG['HOSTNAME'], get_command(), PGLOG['CURUID'])
355355
cmdstr = "{} {} at {}\n".format(CPID['PID'], break_long_string(CPID['CMD'], 40, "...", 1), current_datetime())
356356
fn = "{}/{}".format(PGLOG['LOGPATH'], PGLOG['EMLFILE'])
357-
f = open(fn, 'a')
358-
f.write(cmdstr + emlmsg)
359-
f.close()
357+
try:
358+
f = open(fn, 'a')
359+
f.write(cmdstr + emlmsg)
360+
f.close()
361+
except FileNotFoundError as e:
362+
print(e)
360363

361364
#
362365
# Function: cmdlog(cmdline)

0 commit comments

Comments
 (0)