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


Groups > comp.lang.python > #38485

Re: Monitoring updating directory for image for GUI

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'url:pypi': 0.03; 'none:': 0.05; 'filename': 0.07; 'pypi': 0.07; 'cc:addr:googlegroups.com': 0.09; 'newest': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; 'thread': 0.11; 'stack': 0.15; 'cc:name:python list': 0.16; 'organiser': 0.16; 'producer,': 0.16; 'stream.': 0.16; 'subject:GUI': 0.16; 'subject:image': 0.16; 'subprocess': 0.16; 'suggesting': 0.16; 'threaded': 0.16; 'threads:': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'load': 0.19; 'changes': 0.20; 'trying': 0.21; 'do.': 0.21; 'earlier': 0.21; 'setup.': 0.22; 'absolute': 0.23; 'this:': 0.23; "haven't": 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'creating': 0.26; 'older': 0.27; 'message- id:@mail.gmail.com': 0.27; 'there.': 0.28; 'class': 0.29; 'checks': 0.30; 'figure': 0.30; '(and': 0.32; 'url:python': 0.32; 'file': 0.32; 'could': 0.32; 'getting': 0.33; 'tutorial': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'something': 0.35; 'url:org': 0.36; 'should': 0.36; 'passed': 0.37; 'previous': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'your': 0.60; 'skip:n 10': 0.63; 'more': 0.63; 'notified': 0.65; 'url:6': 0.65; 'consumer': 0.67; 'url:0': 0.67; '(yes,': 0.84; '2013': 0.84; 'oscar': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=nv7bga9WOOZbTOiNa5pKWqEXlEO7CMcRc7HdxbSVAfA=; b=bJ1DEiZ4fFhq98UgEhyAPiQWYebzyxIM9vZg6Oz1tWqgdxaUOpnPex84lrC6Cd7L7N 9iIlhAgdKm99tvM0hV0PmYYEgTIKZev7up23eeoVTcj+MeLBaJxZCUklxyyOgib6+a2Q m/re+7xkNez6ceOLO7wJTCQ/8dIqp3TxsP4mCI0YvSlPGV0rz/42v8E90GYrVY2nL6EQ w+Kz3MCNvpjlDNhdCAifb++Ozl1h7mmmq2x8Xm52jTpUNtvYZsZiAK78w08EVKuZDgrv gz/8qqtOj70VJ7fHuOxeBrFy8t+oHU5c7JyuDCRKXNE5j11kZJI23FdAXr/551xS/5pv AsUg==
X-Received by 10.152.125.239 with SMTP id mt15mr6555963lab.26.1360371247399; Fri, 08 Feb 2013 16:54:07 -0800 (PST)
MIME-Version 1.0
In-Reply-To <8f8eaf8f-2572-4843-87f0-3bafaf98472b@googlegroups.com>
References <8a572770-9cc1-4b65-9053-10fd6c2f543b@googlegroups.com> <mailman.1440.1360218333.2939.python-list@python.org> <02bee1ed-1a9b-4cac-975a-098b3382250f@googlegroups.com> <mailman.1466.1360288892.2939.python-list@python.org> <8f8eaf8f-2572-4843-87f0-3bafaf98472b@googlegroups.com>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date Sat, 9 Feb 2013 00:53:47 +0000
Subject Re: Monitoring updating directory for image for GUI
To Christopher Rucinski <ciscorucinski@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc Python List <python-list@python.org>, comp.lang.python@googlegroups.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1524.1360371249.2939.python-list@python.org> (permalink)
Lines 63
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360371249 news.xs4all.nl 6910 [2001:888:2000:d::a6]:51650
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38485

Show key headers only | View raw


 On 8 February 2013 17:09,  <ciscorucinski@gmail.com> wrote:
>> So you have a thread that updates the image and then checks the stack
>> to see if a new image is available? Can you not just have it only try
>> to load the newest image?
>
> That is what I am trying to figure out how to do. I have a counter that updates with every note that is grabbed from the stream. That counter is passed into a threaded class that might or might not create the image right away...but seems to create them sequentially from what I have seen so far (I don't know if that is absolute thought).
>
> Please let me know you thought on the above part! Each new thread should only take only a very small amount longer to do than the previous thread that was started...because it has one more note to deal with this time.

Are you creating a new thread for each new note? I imagined that you
would have 3 threads: producer, organiser and consumer. It looks like
this:

# Producer:
for x in produce_music():
    counter += 1
    create_note_file(filename)
    notes_map[filename] = counter

# Organiser
def on_file_notify(filename):
    if notes_map[filename] > notes_map[waiting]:
        waiting = filename

# Consumer
while True:
    if waiting is not None:
        display(waiting)
        waiting = None
    else:
       sleep()

[SNIP]
>
> I am not notified when the file is created...but like I said before, I wait on the subprocess and could do something there.

I don't understand your setup.

>
>> Is that using something like watchdog?
>> http://pypi.python.org/pypi/watchdog
>
> I don't know about Watchdog...but from an earlier version of a tutorial online...
>
> http://pypi.python.org/pypi/watchdog/0.3.6  (Yes, it is currently on v0.6.0 and this is older - v0.3.6)
>
> ... it looks like I COULD do something like...

I haven't actually used watchdog myself. I was just querying how you
were getting updates about file changes (and suggesting to use a PyPI
package since at least one was available for your needs).


Oscar

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


Thread

Monitoring updating directory for image for GUI ciscorucinski@gmail.com - 2013-02-06 14:02 -0800
  Re: Monitoring updating directory for image for GUI Chris Angelico <rosuav@gmail.com> - 2013-02-07 17:25 +1100
    Re: Monitoring updating directory for image for GUI ciscorucinski@gmail.com - 2013-02-07 16:48 -0800
      Re: Monitoring updating directory for image for GUI Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-08 02:01 +0000
        Re: Monitoring updating directory for image for GUI ciscorucinski@gmail.com - 2013-02-08 09:09 -0800
          Re: Monitoring updating directory for image for GUI Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-09 00:53 +0000
          Re: Monitoring updating directory for image for GUI Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-08 20:32 -0500
        Re: Monitoring updating directory for image for GUI ciscorucinski@gmail.com - 2013-02-08 09:09 -0800
    Re: Monitoring updating directory for image for GUI ciscorucinski@gmail.com - 2013-02-07 16:48 -0800
  Re: Monitoring updating directory for image for GUI Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-02-07 11:25 +0100
  Re: Monitoring updating directory for image for GUI Piet van Oostrum <piet@vanoostrum.org> - 2013-02-07 18:11 +0100
  Re: Monitoring updating directory for image for GUI ciscorucinski@gmail.com - 2013-02-11 14:50 -0800
    Re: Monitoring updating directory for image for GUI MRAB <python@mrabarnett.plus.com> - 2013-02-11 23:50 +0000
    Re: Monitoring updating directory for image for GUI Piet van Oostrum <piet@vanoostrum.org> - 2013-02-13 17:09 +0100

csiph-web