I wanted to Run Python script through HTML button. I am not using any server.
I tried using local server but it's giving this error : jquery-3.3.1.min.js:2 GET http://127.0.0.1:8080/home/techm/Documents/labelImg-master/labelImg.py 404 (Not Found)
And i tried with out server also I get this error : jquery-3.3.1.min.js:2 Failed to load file:///home/techm/Documents/labelImg-master/labelImg.py: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
this is my HTML code :
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="button" id='script' name="scriptbutton" value=" Run Script " onclick="goPython()">
<script src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script>
function goPython(){
$.ajax({
url: "/home/techm/Documents/labelImg-master/run.sh",
context: document.body
}).done(function() {
alert('finished python script');;
});
}
</script>
</body>
</html>
Is there any other way I can click the button in HTML page and automatically it run python script.