0

While importing oct2py module, here what i got..

>>> import oct2py

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import oct2py
  File "C:\Python27\lib\site-packages\oct2py\__init__.py", line 38, in <module>
    octave = Oct2Py()
  File "C:\Python27\lib\site-packages\oct2py\core.py", line 73, in __init__
    self.restart()
  File "C:\Python27\lib\site-packages\oct2py\core.py", line 508, in restart
    logger=self.logger)
  File "C:\Python27\lib\site-packages\octave_kernel\kernel.py", line 144, in __init__
    self.repl = self._create_repl()
  File "C:\Python27\lib\site-packages\octave_kernel\kernel.py", line 338, in _create_repl
    version = subprocess.check_output(version_cmd).decode('utf-8')
  File "C:\Python27\lib\subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

I have searched few more threads, they talked about subprocessing python shell, but I didn't get that how to do that. So someone please help me to solve this problem.

Suever
  • 64,497
  • 14
  • 82
  • 101
PuNiT
  • 15
  • 4

1 Answers1

1

This happened to me when I added the wrong directory to the PATH. I added C:\Octave\Octave-4.2.1\ instead of the correct C:\Octave\Octave-4.2.1\bin\.

On importing oct2py, it looks for the octave-cli.exe executable which is in the \bin directory.

See also How Can I add Octave in PATH environment variable in Windows 8?

Stephen Terry
  • 6,169
  • 1
  • 28
  • 31