@@ -502,8 +502,8 @@ def on_data_file_path_changed(self):
502502 # Get it back in list form
503503 file_list = file_string .split (',' )
504504 data_paths = [Path (f ) for f in file_list ]
505- try :
506- self .check_valid_binary_path (data_paths )
505+
506+ if self .check_valid_binary_path (data_paths ):
507507 parent_folder = data_paths [0 ].parent
508508 results_folder = parent_folder / "kilosort4"
509509 self .results_directory_input .setText (results_folder .as_posix ())
@@ -516,9 +516,8 @@ def on_data_file_path_changed(self):
516516 self .dataChanged .emit ()
517517 else :
518518 self .disable_load ()
519-
520- except AssertionError :
521- logger .exception ("Please select a valid binary file path(s)." )
519+ else :
520+ print ("Please select a valid binary file path(s)." )
522521 self .disable_load ()
523522
524523 def check_valid_binary_path (self , filename ):
@@ -534,19 +533,23 @@ def check_valid_binary_path(self, filename):
534533 if not isinstance (filename , list ): filename = [filename ]
535534 for p in filename :
536535 f = Path (p )
537- if f .exists () and f .is_file ():
536+ if not f .exists ():
537+ print (f'Binary file does not exist at:\n { f } .' )
538+ check = False
539+ break
540+ elif not f .is_file ():
541+ print (f'Path for binary file is not a file:\n { f } .' )
542+ check = False
543+ break
544+ else :
538545 if f .suffix in _ALLOWED_FILE_TYPES or self .use_file_object :
539546 check = True
540547 else :
541548 print (f"Binary file has invalid suffix. "
542549 "Must be {_ALLOWED_FILE_TYPES}" )
543550 check = False
544551 break
545- else :
546- print ('Binary file does not exist at that path.' )
547- check = False
548- break
549-
552+
550553 self .path_check = check
551554 return check
552555
0 commit comments