I already checked in stack and nobody seems to give proper solution to trigger a python script from html page, it doesn't necessary means a hosted website just a local html file, its possible to run separate java script from html so I guess the same can be done with python
Asked
Active
Viewed 192 times
0
-
1Welcome to Stack Overflow! Please visit the [help], take the [tour] to see what and [ask]. ***[Do some research](https://www.google.com/search?q=run+python+from+html+site%3Astackoverflow.com)***, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output using the `[<>]` snippet editor. – mplungjan Sep 29 '20 at 12:05
-
"it is possible to run separate JavaScript from HTML" - how? You cannot execute node on your local machine from an html page – mplungjan Sep 29 '20 at 12:06
-
@Moncif Mo: Welcome! You cannot launch arbitrary scripts from an HTML document for security reasons. You would need to have your page call a Python script via a web server, for instance. For simple Python web scripting, I suggest you take a look at Flask: https://flask.palletsprojects.com/ – SolarBear Sep 29 '20 at 12:10
-
1@SolarBear thanks for clearing it out, I will get into it – Moncif Mo Sep 29 '20 at 12:21
-
@mplungjan I meant a local html file from your local machine running a local java script, It would be a major security breach if I found a way to do it online ;) – Moncif Mo Sep 29 '20 at 12:24
-
A local file from a local machine cannot run a JS file other than in the scope of the HTML file. You want to run something your normally would run from the terminal/commandline and you cannot di that without some help from example WSH on windows – mplungjan Sep 29 '20 at 12:26