Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102131

Re: show instant data on webpage

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From David Palao <dpalao.python@gmail.com>
Newsgroups comp.lang.python
Subject Re: show instant data on webpage
Date Tue, 26 Jan 2016 17:38:28 +0100
Lines 39
Message-ID <mailman.19.1453826317.2338.python-list@python.org> (permalink)
References <n885p7$1el2$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de Zv4zxvEfXeLecQay2nZWygoM+dr+1KOH5Z449vjLCj0g==
Return-Path <dpalao.python@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'cc:addr:python-list': 0.09; '"w")': 0.09; 'output?': 0.09; 'python.': 0.11; '"a")': 0.16; '17:10': 0.16; 'file.close()': 0.16; 'measurement': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:show': 0.16; 'temp': 0.16; 'true:': 0.16; 'load': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'ok.': 0.22; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'message-id:@mail.gmail.com': 0.27; 'streaming': 0.27; 'measure': 0.29; 'code:': 0.29; 'url:mailman': 0.30; 'url:python': 0.33; 'extract': 0.33; 'values.': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'problem.': 0.35; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'anything': 0.38; 'received:209.85.220': 0.38; 'url:mail': 0.40; 'some': 0.40; 'show': 0.62; 'webpage': 0.66
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=a2slEZZYwFejtrlfjNStLrvxwrINj1eLBc33d9unTOI=; b=HfmcZYCyXMAibYiNxMpRldm3WIBrUGXs4UCEsFpIUorYnE+hOtL5a+IQUXKetXI3jT wwkVtNvrWuEqNaC4g0sDUmwvpZh5xFyJxvzCdSC125/D1T3CExiiwj8nHOnvtLaXMetU lt+qH8IC9/gzUureZpjAM6S5P69B90NahGkwPOHHf6evf2MyLrNDWblwBhoIC2Fu50mB j2G3J83Bi86wAkga/kH4DnNuWh/NCSNPbaPX/zRB3rLw3/pGOsLJaWpIcVGAyuxrsoCj KS0PNET6vyxxZfwLEny2Qdlu8pPfdeLGswMP8CcU8wIw+dHkBzGYNwRaxHctlx1JJ4xj ivSw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=a2slEZZYwFejtrlfjNStLrvxwrINj1eLBc33d9unTOI=; b=dNSy3oIOuxOT1M00YDCGyYU92A4xiuwWJ41eK84goLUscNRafjvIk4ErFlKqkomDEk nsxtRpNdWv6joMUvjrR6Y2x7FLz7XRnhSzznQkxAduPNL7Y3CSLlrXp4ecj+weRMEiNP 3/oDbGjvPBXIkPDc6uKQBV6RF3776BQK/GffKpGd4rkCSmeb4LDilmO3njPNz7h6iUJU YO5auSXs7Dya6ERByaBKUxre/fy0iy2DSkR0d7or5inYH6CUo/bGs11UGk9GzOQZIeUQ HQti7obCi7C0/vsUqyM4SBg7Uodyu/VJRQk9HBQf32KGxFfIP2UTblCm+Ods7OzIcdKj tMYA==
X-Gm-Message-State AG10YOS8Xu+hQZhBY/ldpydagWqzq270LOsHXpGCoCX0mvkVO4ZBVNS1xP1LjmPHQQ6Vzen4+fyJPiXXYdMLPA==
X-Received by 10.55.82.137 with SMTP id g131mr29172492qkb.66.1453826308814; Tue, 26 Jan 2016 08:38:28 -0800 (PST)
In-Reply-To <n885p7$1el2$1@gioia.aioe.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102131

Show key headers only | View raw


2016-01-26 17:10 GMT+01:00 mustang <mustang@nomail.it>:
> 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?
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Is this an option?

open("myData.dat", "w").close()

while True:
    temp = sensor.readTempC()
    riga = "%f\n" % temp
    with open("myData.dat", "a") as f:
        f.write(riga)
    time.sleep(1)

Best

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-26 17:10 +0100
  Re: show instant data on webpage David Palao <dpalao.python@gmail.com> - 2016-01-26 17:38 +0100
    Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-26 18:26 +0100
      Re: show instant data on webpage David Palao <dpalao.python@gmail.com> - 2016-01-27 11:36 +0100
        Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-27 16:36 +0100
          Re: show instant data on webpage Joel Goldstick <joel.goldstick@gmail.com> - 2016-01-27 10:49 -0500
            Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-27 18:20 +0100
      Re: show instant data on webpage "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-01-27 12:02 +0000
        Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-27 16:37 +0100
          Re: show instant data on webpage "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-01-27 16:47 +0000
            Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-27 18:21 +0100
              Re: show instant data on webpage Grant Edwards <invalid@invalid.invalid> - 2016-01-27 17:51 +0000
                Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-29 12:48 +0100
                Re: show instant data on webpage Joel Goldstick <joel.goldstick@gmail.com> - 2016-01-29 07:34 -0500
                Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-30 21:50 +0100
                Re: show instant data on webpage Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-01-30 21:33 +0000
                Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-01-31 20:19 +0100
                Re: show instant data on webpage Joel Goldstick <joel.goldstick@gmail.com> - 2016-01-31 14:48 -0500
                Re: show instant data on webpage mustang <mustang@NOMAIL.it> - 2016-02-21 18:36 +0100
  Re: show instant data on webpage Grobu <snailcoder@retrosite.invalid> - 2016-01-30 05:01 +0100

csiph-web