0

I'm making a screen in HTML where I can load some values according if there's a neccesity or not of some products, and make some tables and graphs using python.

So, when you click the "Load settings" button, the python program I have can take all the info from the HTML and proccess it.

<!DOCTYPE html>
<html>
<head>
<title>Test1</title>
</head>
<body>
<p>Checking order and functionality</p>
<form action="demo_form.asp">
 Delay 5 weeks: <input type="text" name="D5w" value=""><br>
 <input type="button" value="Load" onclick="window.open('C:/Python27/hello.py')">
</form>
</body>
</html>

My problem is in the button, how can I make that it runs the .py program I have?? I tried with window.open() and location.href but it just opens the code in a new tab.

Suggestions??

  • In case you are django, this might help.. http://stackoverflow.com/questions/15166941/create-html-button-to-run-python-script If you are open to using php, or something similar, this might help http://stackoverflow.com/questions/26792899/run-python-script-with-html-button – Explorer Oct 01 '15 at 16:59
  • I'm creating the HTML in a notepad and the .py in Python 2.7 – Joshua Cazares Oct 01 '15 at 17:03
  • This is because my boss is asking me to have a .HTML to add to a program we have and they wanted to have the application in python for later editing of the program I'm making – Joshua Cazares Oct 01 '15 at 17:04
  • You might want to have a look at this http://superuser.com/questions/292818/run-a-shell-script-with-an-html-button – Explorer Oct 01 '15 at 17:06
  • How are you viewing the HTML? I'm not sure this is how it's all meant to work. Web browsers can't usually execute arbitrary programs on the computer. – Peter Wood Oct 01 '15 at 17:08
  • Also, later on I'm adding other buttons to run more python programs to do some other things I have been asked, but first I want this to run some tests and later implement everything. – Joshua Cazares Oct 01 '15 at 17:09
  • The HTML program is not for a web browser, is for another program that can implement .HTML files to make new applications – Joshua Cazares Oct 01 '15 at 17:10
  • I'm checking it with IE I should also say that my company has blockes almost all the downloads, so I can't have Chrome, Firefox, Anaconda (Python)... and asking for permission to do it is kind of a hassle. – Joshua Cazares Oct 01 '15 at 17:17

1 Answers1

0

I solved this issue, using py2exe to convert the .py file into a .exe file that I could execute in HTML. But is there a way to execute that .exe in the background, so that the user doesn´t have to see the black window from python?