Any good donothing?

Gerhard Häring gh at ghaering.de
Tue Apr 15 20:37:00 EDT 2003


* Somebody who thinks pseudonyms like "Dialtone" are k3wl wrote:
> Hi all. I'm working on a kind of all-in-one cd2mp3 encoder based on lame
> and cdda2wav and pygame.
> 
> A little code snippet is the following (it is already indented once
> because it is part of a bigger class, not so bigger, named cd2mp3).
> My problem is to sync the 2 processes which are launched with the
> os.system() call but without having the main program locked.

>From what I remember other such solutions just use pipes to pipe the
output of cdda2wav into the mp3 encoder. No synchronization problems,
then.

> Is there any other way to make a do_nothing_for_some_time(n) function?

The sleep function from the time module does just this. I doubt it
solves your problems, though. I'd look into pipes and try to use them
using os.popen*. If you want to display the progress in a GUI, you might
also want to select.select or select.poll on the file descriptor in
order to keep the GUI smooth.

Gerhard
-- 
mail:   gh at ghaering.de
web:    http://ghaering.de/





More information about the Python-list mailing list