[pygtk] Problem with pygtk, threads, an interactive interpreter and os.system()

Fernando Perez Fernando.Perez at colorado.edu
Wed Aug 18 07:05:19 WST 2004


Gustavo J. A. M. Carneiro wrote:

>   os.system, especially with & at the end of the command, is evil.  You
> should use one of the os.spawn functions instead.  Regardless on whether
> it fixes your problem or not.. :-)

The convenience of system() is that it handles path/platform issues for me 
nicely.  Besides, I need to avoid blowing up in case _users_ call it, I can't 
restrict what commands users will type :)

But just to note, I tested things with the spawn* functions, and the problem 
is just the same.

>   BTW, when gv blocks does the ipython shell block too, or just gv? 

Just gv.  The ipython shell (or even the toy one in my original post) continue 
just fine.

> Does this have anything to do with pygtk at all?

Well, I don't know :)  It's definitely a threading issue, since I've used tons 
of similar code under single-threaded ipython which has never had this kind of 
problem.  And since the point of this exercise is to provide a convenient 
terminal shell which allows users to use/test gtk code interactively (an often 
requested feature for ipython), I figured this list might be an appropriate 
place to try.  I have no idea if the culprit is gv, or if I'm mis-handling the 
pygtk threading functions.

Best,

f


More information about the pygtk mailing list