show instant data on webpage

mustang mustang at NOMAIL.it
Tue Jan 26 11:10:16 EST 2016


I've built a sensor to measure some values.
I would like to show it on a web page with python.


This is an extract of the code:

file  = open("myData.dat", "w")

while True:
         temp = sensor.readTempC()
         riga = "%f\n" % temp
         file.write(riga)
         time.sleep(1.0)

file.close()

Until this all ok.
Then in PHP I read the file and show it on internet. It works ok but...
First problem. I've to stop the streaming with CTRl-C to load the PHP 
file because if I try to read during measurement I cannot show anything 
(I think because the file is in using).
How can I show time by time in a webpage the output?




More information about the Python-list mailing list