Esempio n. 1
0
    def launch(self):
        """Launch Octave and execute setup commands."""
        self._engine = OctaveEngine()

        if self.octaverc:
            self.eval('source("' '%s' '")' % self.octaverc)

        for path in self.paths:
            self.eval('addpath("' '%s' '")' % path)
Esempio n. 2
0
    def restart(self):
        """Restart an Octave session in a clean state
        """
        if self._engine:
            self._engine.repl.terminate()

        if 'OCTAVE_EXECUTABLE' not in os.environ and 'OCTAVE' in os.environ:
            os.environ['OCTAVE_EXECUTABLE'] = os.environ['OCTAVE']

        self._engine = OctaveEngine(stdin_handler=self._handle_stdin,
                                    logger=self.logger)

        # Add local Octave scripts.
        self._engine.eval('addpath("%s");' % HERE.replace(osp.sep, '/'))
Esempio n. 3
0
    def restart(self):
        """Restart an Octave session in a clean state"""
        if self._engine:
            self._engine.repl.terminate()

        if "OCTAVE_EXECUTABLE" not in os.environ and "OCTAVE" in os.environ:
            os.environ["OCTAVE_EXECUTABLE"] = os.environ["OCTAVE"]

        try:
            self._engine = OctaveEngine(stdin_handler=self._handle_stdin, logger=self.logger)
        except Exception as e:
            raise Oct2PyError(str(e))

        # Add local Octave scripts.
        self._engine.eval('addpath("%s");' % HERE.replace(osp.sep, "/"))
Esempio n. 4
0
    def restart(self):
        """Restart an Octave session in a clean state
        """
        if self._engine:
            self._engine.repl.terminate()

        executable = self._executable
        if executable:
            os.environ['OCTAVE_EXECUTABLE'] = executable
        if 'OCTAVE_EXECUTABLE' not in os.environ and 'OCTAVE' in os.environ:
            os.environ['OCTAVE_EXECUTABLE'] = os.environ['OCTAVE']

        self._engine = OctaveEngine(stdin_handler=self._handle_stdin,
                                    logger=self.logger)

        # Add local Octave scripts.
        here = os.path.realpath(os.path.dirname(__file__))
        self._engine.eval('addpath("%s");' % here.replace(os.path.sep, '/'))