[Python] letture asincrone da piu' files

Nicola Larosa nico a teknico.net
Lun 13 Ott 2008 22:13:38 CEST


Stefano Dal Pra wrote:
> delle informazioni vengono loggate da alcuni servizi su tre files distinti
> e io vorrei "ascoltare" questi tre files e comporre dei dizionari con
> informazioni che vengono dai tre files.
> ...
> Il problema e' insomma quello di iterare su linee prodotte in modo
> asincrono da tre files...
> 
> Sto spulciando documentazione e documenti vari ma per ora non so bene
> quale metodo (thread,code,signal,fcntl....) sia migliore
> Avete suggerimenti su quale approccio usare?

Certo, twisted ovviamente. :-)

http://twistedmatrix.com/documents/current/api/twisted.internet.fdesc.html

Prendi spunto dai test:

http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.1.0/twisted/test/test_fdesc.py

-- 
Nicola Larosa - http://www.tekNico.net/

Your Clock Time, that passes and is gone and fills you with regret
for what was or what might be or what should be or what might have
been, it is just an abstraction, a human artifact, designed to keep
you in thrall to the other humans who want you to be everybody-else,
obedient, fearful, helpless, dependent, full of grief.
 - Unique Chickadee to Dave Pollard, June 2008




Maggiori informazioni sulla lista Python