def findfile(file, here=__file__, subdir=None):
 if os.path.isabs(file):
  return file
 if (subdir is not None):
  file = os.path.join(subdir, file)
 path = sys.path
 path = ([os.path.dirname(here)] + path)
 for dn in path:
  fn = os.path.join(dn, file)
  if os.path.exists(fn):
   return fn
 return file

def findfile ( file , here = __file__ , subdir = None ) : if os . path . isabs ( file ) : return file if ( subdir is not None ) : file = os . path . join ( subdir , file ) path = sys . path path = ( [ os . path . dirname ( here ) ] + path ) for dn in path : fn = os . path . join ( dn , file ) if os . path . exists ( fn ) : return fn return file
try to find a file on sys .