Skip to content

Commit b9b911d

Browse files
committed
better error handling in build_taskfile.py
1 parent 2dda484 commit b9b911d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

build_taskfile.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,28 @@ def build_taskfile(function, directory_list=None):
3030
task.append('cd '+directory)
3131

3232
if function == 'segment':
33-
task.append('segment segment_settings.txt')
33+
if os.path.exists(directory+'/segment_settings.txt'):
34+
task.append('segment segment_settings.txt')
35+
else:
36+
print 'Settings file not found in %s. Double check your directory list: %s' % (directory, directory_list)
37+
continue
3438
elif function == 'focus':
3539
task.append('focus final')
40+
3641
elif function == '2dmorph':
37-
task.append('run2dmorph 2dmorph_settings.txt')
42+
if os.path.exists(directory+'/2dmorph_settings.txt'):
43+
task.append('run2dmorph 2dmorph_settings.txt')
44+
else:
45+
print 'Settings file not found in %s. Double check your directory list: %s' % (directory, directory_list)
46+
continue
47+
3848
elif function == '3dmorph':
39-
task.append('run3dmorph 3dmorph_settings.txt')
49+
if os.path.exists(directory+'/3dmorph_settings.txt'):
50+
task.append('run3dmorph 3dmorph_settings.txt')
51+
else:
52+
print 'Settings file not found in %s. Double check your directory list: %s' % (directory, directory_list)
53+
continue
54+
4055
else:
4156
sys.exit(1)
4257

0 commit comments

Comments
 (0)