Check if data directory exists to avoid program abortion.
This commit is contained in:
parent
37c8858096
commit
dccbaa357a
17
PyLoT.py
17
PyLoT.py
@ -3807,13 +3807,16 @@ class Project(object):
|
||||
datapaths.append(event.datapath)
|
||||
for datapath in datapaths:
|
||||
datapath = os.path.join(self.rootpath, datapath)
|
||||
for filename in os.listdir(datapath):
|
||||
filename = os.path.join(datapath, filename)
|
||||
if os.path.isfile(filename) and filename.endswith(fext):
|
||||
try:
|
||||
self.read_eventfile_info(filename)
|
||||
except Exception as e:
|
||||
print('Failed on reading eventfile info from file {}: {}'.format(filename, e))
|
||||
if os.path.isdir(datapath):
|
||||
for filename in os.listdir(datapath):
|
||||
filename = os.path.join(datapath, filename)
|
||||
if os.path.isfile(filename) and filename.endswith(fext):
|
||||
try:
|
||||
self.read_eventfile_info(filename)
|
||||
except Exception as e:
|
||||
print('Failed on reading eventfile info from file {}: {}'.format(filename, e))
|
||||
else:
|
||||
print("Directory %s does not exist!" % datapath)
|
||||
|
||||
def getPaths(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user