Running the bat file
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gopalakrishnan venkatesan
le 26 Juin 2017
Modifié(e) : dpb
le 26 Juin 2017
I have bat file named data.bat with simple command "python". When i double click the bat file python is running successfully. But when i run the bat file from MATLAB using the commands below,
dos('C:\Users\W25VCSQ\Desktop\data.bat &') or system('data.bat')
I am getting the error "The command python is either false or not found"
How should i call the bat file or how should the bat file should be written?
Thanks a lot
5 commentaires
dpb
le 26 Juin 2017
Modifié(e) : dpb
le 26 Juin 2017
OK, but not the full context from Matlab--only a bit at a time that we can't see the whole problem from.
Again, a piece of code with all variables in it defined executed and then the error message all in one complete piece.
Also, you can execute
system &
and then check what are the environment variables (particularly PATH) and whether
python
at that command prompt will run/be found or not. If not, you need to either use fully-qualified path to the executable or execute a PATH= command first in the .bat file to set the PATH as needed for the session.
Réponse acceptée
dpb
le 26 Juin 2017
When the new process is spawned, it inherits default environment (PATH and other variables). If python isn't installed on that default path, it won't be found. Have the .bat file set any environment variables it needs or modify the startup environment to make that a global setting all sessions will inherit. The former is probably the more appropriate rather than modifying system.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!