PuNiT
PuNiT

Reputation: 15

importing oct2py in python2.7.9 gives WindowsError: [Error 2] The system cannot find the file specified

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.

Upvotes: 0

Views: 188

Answers (1)

Stephen Terry
Stephen Terry

Reputation: 6279

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?

Upvotes: 1

Related Questions