-1

I'm trying what i think is something new, I have a controller which contains the server side of the websocket, controlling my lights. Then i have a plant PC/Dead PC, to run a python script, when the webpage sends a request. the dead computer recives it, and runs the python program. the problem is the python program needs information from the user, which is send by the webpage.

The python program only runs when the user calls it, and then closes. And all the answers i have found about JS to python, PHP to python, all require python to run the webpage with flask or cgi etc.. but I need it to run, then send something to the webpage that the user can answer, and then send the answer back to the python script.

TL:DR

How to pass a value from a local webpage to python, where python is not the framework of the webpage, python only reads and send data to the webpage.

side note, Cause I don't know if it is clear: Controller runs the server, the pc connects to the webpage, when user request a change, the server sends a function to all clients, when the plant pc recives that message it starts the python program. the program then needs more information from the webpage, but is not the framework of the webpage. is there any way i can connect a python variable to webpage btn.

x = Request.form['btn']
print(x)

x should then be '1' or '2', what ever the btn value is set to.

y = int(x)

to convert it to an int, so i can use it for my loop

for i in range(y)
    pass # do the whole program as many times as requested
  • 1
    Not sure what the implementation issue is? – guest271314 Dec 18 '18 at 16:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.