catch non string type input for filename construction

This commit is contained in:
Sebastian Wehling-Benatelli 2015-06-10 15:43:43 +02:00
parent 3cb73fb948
commit ba7ab07473

View File

@ -12,7 +12,10 @@ import obspy.core.event as ope
def fnConstructor(s): 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_. ]+|^\.|\.$|^ | $|^$') badchars = re.compile(r'[^A-Za-z0-9_. ]+|^\.|\.$|^ | $|^$')
badsuffix = re.compile(r'(aux|com[1-9]|con|lpt[1-9]|prn)(\.|$)') badsuffix = re.compile(r'(aux|com[1-9]|con|lpt[1-9]|prn)(\.|$)')