def reopen(self):
        """IF opened close THEN open self._file from self.path
           Otherwise use sys.stdout
        """
        self.close()

        if self._path:
            try:
                self._path = os.path.abspath(os.path.expanduser(self._path))
                dirpath = os.path.dirname(self._path)
                if not os.path.exists(dirpath):
                    try:
                        os.makedirs(dirpath)
                    except __HOLE__ as ex:
                        msg = ("Error creating console file directory {0}. "
                               "{1}\n".format(dirpath, ex))
                        sys.stderr.write(msg)
                        return False
                self._file = Console.ocfn(self._path, 'a+') # open or create file
                self._file.seek(0, os.SEEK_END) # append but not forced
            except IOError as ex:
                msg = "Error opening console file {0}. {1}\n".format(self._path, ex)
                sys.stderr.write(msg)
                return False
        else:
            self._file = sys.stdout

        return True
dataset/ETHPy150Open ioflo/ioflo/ioflo/aid/consoling.py/Console.reopen