Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40957
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <bahamutzero8825@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'cpython': 0.05; 'socket': 0.05; 'subject:skip:s 10': 0.05; 'try:': 0.07; 'exception:': 0.09; 'happens.': 0.09; 'port))': 0.09; 'subclass': 0.09; 'thread,': 0.09; 'def': 0.10; 'sock': 0.16; 'sock.close()': 0.16; 'subject:questions': 0.16; 'subject:threads': 0.16; 'threading': 0.16; 'wrote:': 0.17; 'windows': 0.19; 'import': 0.21; 'defined': 0.22; 'errors': 0.23; 'somebody': 0.23; 'raise': 0.24; 'host': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'subject:/': 0.28; 'run': 0.28; 'queue': 0.29; 'probably': 0.29; 'stuff': 0.30; 'code': 0.31; 'point': 0.31; 'getting': 0.33; 'asked': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'false': 0.35; 'received:192.168.0': 0.35; 'created': 0.36; 'except': 0.36; 'but': 0.36; 'message- id:@gmail.com': 0.36; "didn't": 0.36; 'should': 0.36; 'skip:p 20': 0.36; 'subject:http': 0.37; 'why': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'nothing': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'help': 0.40; 'real': 0.61; 'mentioned': 0.63; 'different': 0.63; 'here': 0.65; '9.1': 0.84; 'researched': 0.84; 'anywhere,': 0.93; 'subject:chat': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=NctcysLLLRk6KzNKSFI9Vg6wafPAiJwxKfUuaS0AAAI=; b=vdNlPKv7qbWRvmAFAgRTc2kYEXg87LiTyvNtRQSH1JGK640biamwULOKrFY7rptaFW ANLwXTlVEBkMEBbcuwW64/qSX6/dxdyEYYDIsW46PIqIgAGo2i745PwgECtZrf1CVBSM Bi2Mmzrr47PtK92iel2wPFy5RUkXRLY1a6dzVXKjODynQ6X3YHj7RhotpMnnYjuWuu/S Yfk/72XeFRqKxUUApfiVsZjcclzpihSFnHR3CIQ45z0Y5JyXhVp/II5HiWfDxQab/VB1 yW0oiZYcGMW8QWfI8mujSCLW9D8pd+hD1mZVIUlxPCzvikyfAr0XlM+EWT8jx3TutUMW sDzQ== |
| X-Received | by 10.50.135.8 with SMTP id po8mr2728087igb.41.1362846949610; Sat, 09 Mar 2013 08:35:49 -0800 (PST) |
| Date | Sat, 09 Mar 2013 10:35:49 -0600 |
| From | Andrew Berg <bahamutzero8825@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
| MIME-Version | 1.0 |
| To | "comp.lang.python" <python-list@python.org> |
| Subject | Re: http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads |
| References | <f9f28b67-cf81-4d9e-96fd-fe4e75fb8c9c@googlegroups.com> |
| In-Reply-To | <f9f28b67-cf81-4d9e-96fd-fe4e75fb8c9c@googlegroups.com> |
| X-Enigmail-Version | 1.5.1 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3132.1362846957.2939.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362846957 news.xs4all.nl 6912 [2001:888:2000:d::a6]:47162 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40957 |
Show key headers only | View raw
On 2013.03.09 09:26, Owatch wrote:
> Thing is, when I run the program. Nothing happens.
>
> Can somebody help point out what is wrong? (I've asked questions and researched for 3 days, without getting anywhere, so I did try)
You defined a thread, but never created or started it. Also, why did you
subclass threading.Thread? You also mentioned queues, but you didn't use
them.
Not tested, but shows the basics:
import threading
import queue
import socket
def process():
while alive:
thing = things_to_process.get()
# do stuff with the thing here
things_to_process.task_done()
alive = True
host = 'localhost'
port = 9999
things_to_process = queue.Queue()
process_thread = threading.Thread(target=process)
process_thread.start()
sock = socket.socket()
sock.connect((host, port))
while alive:
try:
data = sock.recv()
except Exception: # should probably do different things for different
errors in real code
alive = False
sock.close()
process_thread.join()
raise
else:
things_to_process.put(data)
--
CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads Owatch <charles.xrandolph2@gmail.com> - 2013-03-09 07:26 -0800
Re: http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads Andrew Berg <bahamutzero8825@gmail.com> - 2013-03-09 10:35 -0600
Re: http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads Owatch <charles.xrandolph2@gmail.com> - 2013-03-09 13:23 -0800
csiph-web