Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25025
| Date | 2012-07-07 18:12 +0200 |
|---|---|
| From | Thomas Jollans <t@jollybox.de> |
| Subject | Re: Socket code not executing properly in a thread (Windows) |
| References | <jt9ec1$e5s$1@dont-email.me> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1895.1341677582.4697.python-list@python.org> (permalink) |
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: http://lickitung.it.cx/exe/bot/bot.py):
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
option)
Thomas
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Socket code not executing properly in a thread (Windows) "Andrew D'Angelo" <excel@pharcyde.org> - 2012-07-08 05:55 -0500
Re: Socket code not executing properly in a thread (Windows) Thomas Jollans <t@jollybox.de> - 2012-07-07 18:12 +0200
Re: Socket code not executing properly in a thread (Windows) "Andrew D'Angelo" <excel@pharcyde.org> - 2012-07-07 11:33 -0500
Re: Socket code not executing properly in a thread (Windows) John Nagle <nagle@animats.com> - 2012-07-07 12:17 -0700
Re: Socket code not executing properly in a thread (Windows) "Andrew D'Angelo" <excel@pharcyde.org> - 2012-07-08 04:03 -0500
Re: Socket code not executing properly in a thread (Windows) Thomas Jollans <t@jollybox.de> - 2012-07-08 13:01 +0200
csiph-web