Socket code not executing properly in a thread (Windows)

Thomas Jollans t at
Sat Jul 7 18:12:54 CEST 2012

On 07/08/2012 12:55 PM, Andrew D'Angelo wrote:

Please set your clock to the correct date and time.

> (If it would help, the
> full code can be seen here:

No, it can't.

> def sendPrivateMessage(channel, message):#private message send function
>     global mute
>     if mute == 0:
>         IRC.send("PRIVMSG " + channel + " :" + message + "\r\n") #IRC being 
> the socket

Do you have an error message or something?

Without knowing more about the IRC library you're using, it's hard to
say what the reason behind the platform-dependent behaviour is. However,
it's clear that you should be calling IRC.send from the main thread.
That shouldn't be too hard to achieve, save the message to some sort of
event or outgoing message queue that the main thread processes in sequence.

(This sounds to me like an application better implemented thread-less,
using select() or some method of asynchronous I/O. Just a shame that
Python makes neither at all pleasant and leaves threads as the nicest


More information about the Python-list mailing list