def find_executable_in_dir(dirname=None):
 if (platform.system() == 'Windows'):
  exe_name = 'caffe.exe'
 else:
  exe_name = 'caffe'
 if (dirname is None):
  dirnames = [path.strip('"\' ') for path in os.environ['PATH'].split(os.pathsep)]
 else:
  dirnames = [dirname]
 for dirname in dirnames:
  path = os.path.join(dirname, exe_name)
  if (os.path.isfile(path) and os.access(path, os.X_OK)):
   return path
 return None

def find_executable_in_dir ( dirname = None ) : if ( platform . system ( ) == 'Windows' ) : exe_name = 'caffe.exe' else : exe_name = 'caffe' if ( dirname is None ) : dirnames = [ path . strip ( '"\' ' ) for path in os . environ [ 'PATH' ] . split ( os . pathsep ) ] else : dirnames = [ dirname ] for dirname in dirnames : path = os . path . join ( dirname , exe_name ) if ( os . path . isfile ( path ) and os . access ( path , os . X_OK ) ) : return path return None
returns the path to the caffe executable at dirname if dirname is none .