Run python from octave

run python from octave I run python :

output = system ("path\abc.py",1) 

As a rezult output=1
But file abc.py do not begin run without diagostic error.
Can you help?
In Matlab I use next comands:

system('cd C:path\') 
system('cd C:\path\ && start python name_file.py') 

In Octave these commands give an error - &&
More preferably without installing additional programs.

Some questions:

  1. You run Octave and Matlab on MS Windows?
  2. Which Octave version do you use?
  3. What error message does Octave give?
  4. If the Python script is short, can you post the content of that script?
  1. Win 7, 64

  2. GNU Octave ver. 6.1.0,


octave program

octave comand windows

disp(‘00307 trach_seeking_nick02’)
system(‘cd C:\Rezults’)
disp('00311 ')
system(‘cd C:\Rezults\start python create_empty_network_nick08.py’)
disp('00316’)

00307 trach_seeking_nick02
The system cannot find the path specified.
ans = 1
00311
The system cannot find the path specified.
ans = 1
00316

To check the correct path to the python file, in octave I go to the start line and stay. Then и via microsoft windows successfully start python file without error:
Four successful file executions:
mceclip0.png

Igor

3 апреля 2021, 19:25:04, от “Kai Torben Ohlhus via GNU Octave” <octave@discoursemail.com>:

This might be unrelated. But are you using the same version of python in Octave that you are using at the command prompt?
The Windows installer of Octave bundles a minimal version of python that was only ever thought to be used with the “symbolic” package that is bundled with the installer.

If you want to use Python for anything else, install a full blown version of it and set the necessary variables for it to be picked up from inside Octave.
See, e.g. option 2 on this page:
Notes on Windows installation · cbm755/octsympy Wiki · GitHub

Something similar came up repeatedly recently. I wonder where we could document that to make it clearer to users what is going on…

See also: GNU Octave - Bugs: bug #60343, Document that MXE Octave bundles a… [Savannah]

I agree to your suspicion. @Igor1954 what is the output for:

>> version ()
ans = 6.1.0

>> system ('where python')
C:\Octave\Octave-6.1.0\usr\bin\python.exe
C:\Users\siko1056\AppData\Local\Microsoft\WindowsApps\python.exe
ans = 0

>> system ('cmd /c ""C:\Octave\Octave-6.1.0\usr\bin\python.exe""')
Python 3.8.2 (default, Apr 16 2020, 16:12:56)
[GCC 9.3.0] on msys
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

In my case the second “Python” is some link to the MS Windows Store. Does Python start at all?

Thanks for the help.

I took a radical path.
Install Windows 10.
Changed the name of the administrator from Cyrillic to English.
Successfully starting python from octave:
system(‘C:\username…python…\ start python name_file.py’)

Best regards,
Igor

7 апреля 2021, 04:46:22, от “Kai Torben Ohlhus via GNU Octave” <octave@discoursemail.com>:

Thanks for the help.

I took a radical path.
Install Windows 10.
Changed the name of the administrator from Cyrillic to English.
Successfully starting python from octave:
system(‘C:\username…python…\ start python name_file.py’)

Best regards,
Igor

6 апреля 2021, 10:30:20, от “Markus Mützel via GNU Octave” <octave@discoursemail.com>: