Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'irc': 0.05; 'socket': 0.05; 'subject:code': 0.07; 'subject:Windows': 0.09; 'python': 0.09; 'shame': 0.09; 'def': 0.10; 'subject:not': 0.11; 'thread': 0.11; 'library': 0.15; "can't.": 0.16; 'received:192.168.1.50': 0.16; 'sequence.': 0.16; 'thread.': 0.16; 'threads': 0.16; 'using,': 0.16; 'wrote:': 0.17; "shouldn't": 0.17; 'sort': 0.21; 'clock': 0.22; '(this': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'implemented': 0.27; 'andrew': 0.27; 'correct': 0.28; 'behaviour': 0.29; 'leaves': 0.29; 'option)': 0.29; 'queue': 0.29; 'no,': 0.29; 'function': 0.30; 'error': 0.30; 'code': 0.31; 'channel': 0.32; 'help,': 0.32; 'to:addr:python- list': 0.33; 'clear': 0.35; 'pm,': 0.35; 'method': 0.36; 'should': 0.36; 'too': 0.36; 'subject: (': 0.36; 'being': 0.37; 'subject:: ': 0.38; 'behind': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'application': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'save': 0.61; 'here:': 0.62; 'received:62': 0.62; 'is.': 0.62; 'thomas': 0.62; 'url:it': 0.62; 'more': 0.63; 'sounds': 0.71; 'from:addr:t': 0.84; 'received:62.75': 0.84; 'outgoing': 0.91; 'url:bot': 0.91 Date: Sat, 07 Jul 2012 18:12:54 +0200 From: Thomas Jollans User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Socket code not executing properly in a thread (Windows) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341677582 news.xs4all.nl 6981 [2001:888:2000:d::a6]:45476 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25025 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