calling functions across threads
Steve Holden
steve at holdenweb.com
Wed Dec 29 16:24:00 EST 2004
Steven Bethard wrote:
> Fernando Perez wrote:
>
>> Steven Bethard wrote:
>>
>>
>>> Fernando Perez wrote:
>>>
>>>> Steven Bethard wrote:
>>>>
>>>>
>>>>
>>>>> I get the correct output, but if you run this yourself, you'll see
>>>>> that
>>>>> the numbers 1 through 10 aren't printed in sync with the writes (i.e.
>>>>> every half second); they're all printed at the end. Could someone
>>>>> explain to me why this happens, and how (if possible) I can get the
>>>>> numbers printed in sync with the appends to the list?
>>>>
>>>>
>>>>
>>>> This is just a shot in the dark, as I'm quite ignorant of threading
>>>> details.
>>>> But what happens if you try adding a sys.stdout.flush() call after
>>>> the print
>>>> statement in your custom update() method? It may just be a flushing
>>>> problem
>>>> what makes the output appear out of sync...
>>>
>>>
>>> Strangely enough, that causes PythonWin to hang... Why that would be
>>> true, I have no idea...
>>
>>
>>
>> Mmh. I wouldn't be surprised if under pythonwin, sys.stdout is not
>> the true
>> python sys.stdout. Check the following:
>>
>> sys.stdout is sys.__stdout__
>>
>> The answer is probably false. In that case, they may have implemented
>> some
>> incomplete object whose flush method is broken, or something similar.
>> I can't
>> confirm, as I don't have windows access, so this is just a guess.
>
>
> Just to verify, yes, the answer is False:
>
> py> import sys
> py> sys.stdout is sys.__stdout__
> False
>
> Is there a list to ask PythonWin specific questions somewhere, or should
> I just wait for a PythonWin expert around here?
>
> Steve
There's a mailing list at python-win32 at python.org - it's listed on
www.python.org should you choose to subscribe, and the volume isn't
generally high (maybe 5-10 messages per day).
regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
More information about the Python-list
mailing list