Socket code not executing properly in a thread (Windows)

Andrew D'Angelo excel at
Sun Jul 8 12:55:03 CEST 2012

Hi, I've been writing an IRC chatbot that an relay messages it recieves as
an SMS.
As it stands, I can retrieve and parse SMSs from Google Voice perfectly, and
print them to the console. The problem lies in actually posting the message
to the IRC channel. Since the SMS checker runs in a thread apart from the
regular chatbot duties, the socket communication also takes place in the
thread. Something even stranger is that the code works on OS X, but not on
WIndows, where my server runs. Here is a code snippet (If it would help, the
full code can be seen here:
def checkVoice():

    global upHz

    global CHANNEL

    global mute

    while 1:

        print "Update voice!"


        msgitems = [] #Extract all conversations by searching for a DIV with
an ID at top level.

        tree = BeautifulSoup(voice.sms.html)

        conversations = tree.findAll("div",attrs={"id" :

        #parsing code cut for brevity - I know it works, though

                sendPrivateMessage(CHANNEL,message) #as far as I can tell, 
this is failing to execute


def sendPrivateMessage(channel, message):#private message send function

    global mute

    if mute == 0:

        IRC.send("PRIVMSG " + channel + " :" + message + "\r\n") #IRC being 
the socket

More information about the Python-list mailing list