I have a python + electronJS + Djangao app. I am trying to launch a python script with a button click (from the HTML front end).
The app launches fine. But when I click the button to launch the python script from the HTML window, nothing happens (I get a blank HTML page).
Here is my java script file:
let {PythonShell} = require('python-shell')
var path = require("path")
function get_weather() {
let pyshell = new PythonShell('Emotion-recognition-master/real_time_video.py', options);
//let python = spawn('python', [path.join(__dirname, '/home/ironmantis7x/Documents/BSSTLLC/electronJS/electronpydemo1/python-app-with-electron-gui/engine/Emotion-recognition-master', 'real_time_video.py'), obsFilePath, navFilePath]);
pyshell.on('message', function(message) {
swal(message);
})
//document.getElementById("city").value = "";
}
Here is my HTML code for the gui launcher:
<body>
<div class="container">
<div class="jumbotron">
<h1><b><center>MAVERICK Sentry System</center></b></h1>
<h3><i><center>by Maverick AI - a Saudi Company</center></i></h3>
<br>
<br>
<center>
<div class="row">
<div class="col-xs-4">
<img style="width:40%;padding:5px" src="images/weather-icon.png"/>
<br>
<button class="btn btn-info"><a style="color:white" href="weather.html">Weather</a></button>
<div class="col-xs-4">
<img style="width:40%;padding:5px" src="images/emotion_recognition.png"/>
<br>
<button class="btn btn-info"><a style="color:white;" href="real_time_video.py">Emotion Recognition</a></button>
</div>
<div class="col-xs-4">
<img style="width:40%;padding:5px" src="images/text_recognition.png"/>
<br>
<button class="btn btn-info"><a style="color:white;" href="http://127.0.0.1:5000/detect">Text Recognition</a></button>
</div>
</center>
</div>
</div>
<body>
How can I run my python script from html button click properly?