try.html file:-
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<input type="button" class="btn" id="processbtn" value="Process" onclick="get_tt()" />
<script src="try3.js"></script>
</body>
</html>
try3.js file:-
function get_tt() {
document.getElementById("processbtn").value = "Hang on..."
var python = require("python-shell")
var path = require("path")
var options = {
scriptPath: path.join(__dirname, ''),
pythonPath: 'C:/Users/Lenovo/Anaconda3/python'
}
var f = new python("hello.py", options);
f.end(function(err, code, message) {
document.getElementById("processbtn").value = "Done";
})
}
The python code is not executing using this code. The value of button changes to Hang on... ,and remains in the same state.