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: 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> <02bee1ed-1a9b-4cac-975a-098b3382250f@googlegroups.com> <8f8eaf8f-2572-4843-87f0-3bafaf98472b@googlegroups.com> From: Oscar Benjamin Date: Sat, 9 Feb 2013 00:53:47 +0000 Subject: Re: Monitoring updating directory for image for GUI To: Christopher Rucinski Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python List , 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 8 February 2013 17:09, 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 u= pdates with every note that is grabbed from the stream. That counter is pas= sed into a threaded class that might or might not create the image right aw= ay...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 th= at 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 +=3D 1 create_note_file(filename) notes_map[filename] =3D counter # Organiser def on_file_notify(filename): if notes_map[filename] > notes_map[waiting]: waiting =3D filename # Consumer while True: if waiting is not None: display(waiting) waiting =3D None else: sleep() [SNIP] > > I am not notified when the file is created...but like I said before, I wa= it 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 o= nline... > > 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