From ba7ab07473cf171a10489c5783994a9e5f1be271 Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Wed, 10 Jun 2015 15:43:43 +0200 Subject: [PATCH] catch non string type input for filename construction --- pylot/core/util/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pylot/core/util/utils.py b/pylot/core/util/utils.py index d60f52b3..5f93b96a 100644 --- a/pylot/core/util/utils.py +++ b/pylot/core/util/utils.py @@ -12,7 +12,10 @@ import obspy.core.event as ope def fnConstructor(s): - s = s.split('/')[-1] + if type(s) is str: + s = s.split('/')[-1] + else: + s = getHash(UTCDateTime()) badchars = re.compile(r'[^A-Za-z0-9_. ]+|^\.|\.$|^ | $|^$') badsuffix = re.compile(r'(aux|com[1-9]|con|lpt[1-9]|prn)(\.|$)')