Problem with multithreading
MRAB
python at mrabarnett.plus.com
Thu Jun 25 17:57:20 EDT 2009
Jeffrey Barish wrote:
[snip]
> Lou Pecora wrote:
>
>> Try putting a flush in after the 2nd print statement in case the output
>> is left in some I/O buffer when the thing terminates. e.g.
>>
>> import sys
>>
>> ....
>>
>> try:
>> print 'in try"
>> sys.stdout.flush()
>> <do something>
>>
>
> I was hoping for some suggestions of things to think about, so thanks
> especially to those who had such suggestions. Believe it or not (and I'm
> having trouble believing it myself), I didn't think to use flush. When I
> did, I found that, indeed, the program did progress past the try statement.
> It made it to a call to GStreamer (playbin2), which has been proving itself
> intractable in my experience. Note that my test program (which works)
> excised GStreamer. The next step will be to try again to compile the
> latest version of PyGST as the version in Ubuntu 9.04 is one generation
> old. The last time I tried, the compile failed. This is the first time in
> days that I have had any hope.
On occasion I've needed to debug a program that's crashing, and I've
found it best to open the log file unbuffered, otherwise I lose the
final log messages. It saves me from having to flush each message
explicitly.
More information about the Python-list
mailing list