heron-blocks.org 484 B


  def sanitise_path(fname):
      """License GPL v.3
      fname -- str() : name of the file to open


      Requires
      --------
      <<import_Path.py>>
      <<import_expandvars.py>>
      """
      fpath = Path(expandvars(fname)).expanduser()
      fpath_abs = fpath.absolute()
      if fpath.exists():
          return str(fpath_abs), fpath
      else:
          raise ValueError("The path cannot be opened\n" +
                           fname)