hi everyone,
i am trying to write a small chat, to get to know mutlithreading and sockets, but i keep getting this exception, and i have no idea how to deal with it.
can somebody help me out? the function that is giving me trouble is below
def listen():
global s
global lock
global frm
data = “”
while True:
data = s.recv(1024)
lock.acquire()
frm.output.AppendText(“server: “+data +”\n”)
frm.output.Refresh()
lock.release()
if frm.killflag:
thread.exit_thread()
data = s.recv(1024)
File “E:\Program files\python\lib\socket.py”, line 165, in _dummy
raise error(EBADF, ‘Bad file descriptor’)
socket.error: [Errno 9] Bad file descriptor
Unhandled exception in thread started by <function send at 0x0000000003652898>
also: how can i write something like this without using global variables?
crap, i just noticed, i didn't mark the end of the code. it ends with
thread.exit_thread()
after that its the compiler output.
thanks for your help
···
On Jun 16, 3:43 pm, Jan-Heiner Dreschhoff <hdreschh...@gmail.com> wrote:
hi everyone,
i am trying to write a small chat, to get to know mutlithreading and
sockets, but i keep getting this exception, and i have no idea how to deal
with it.
can somebody help me out? the function that is giving me trouble is below
def listen():
global s
global lock
global frm
data = ""
while True:
data = s.recv(1024)
lock.acquire()
frm.output.AppendText("server: "+data +"\n")
frm.output.Refresh()
lock.release()
if frm.killflag:
thread.exit_thread()
data = s\.recv\(1024\)
File "E:\Program files\python\lib\socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor
Unhandled exception in thread started by <function send at
0x0000000003652898>
also: how can i write something like this without using global variables?
On Jun 16, 8:43 am, Jan-Heiner Dreschhoff <hdreschh...@gmail.com> wrote:
hi everyone,
i am trying to write a small chat, to get to know mutlithreading and
sockets, but i keep getting this exception, and i have no idea how to deal
with it.
can somebody help me out? the function that is giving me trouble is below
def listen():
global s
global lock
global frm
data = ""
while True:
data = s.recv(1024)
lock.acquire()
frm.output.AppendText("server: "+data +"\n")
frm.output.Refresh()
lock.release()
if frm.killflag:
thread.exit_thread()
data = s\.recv\(1024\)
File "E:\Program files\python\lib\socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor
Unhandled exception in thread started by <function send at
0x0000000003652898>
also: how can i write something like this without using global variables?
So, what did this have to do with wxPython? If you do use threads in
wx, you'll want to read this wiki page:
sorry, about that. i forgot about the wx part...was coding a gui and
needed more threads.
discard my inquirey
···
On Jun 16, 7:51 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
Hi,
On Jun 16, 8:43 am, Jan-Heiner Dreschhoff <hdreschh...@gmail.com> > wrote:
> hi everyone,
> i am trying to write a small chat, to get to know mutlithreading and
> sockets, but i keep getting this exception, and i have no idea how to deal
> with it.
> can somebody help me out? the function that is giving me trouble is below
> def listen():
> global s
> global lock
> global frm
> data = ""
> while True:
> data = s.recv(1024)
> lock.acquire()
> frm.output.AppendText("server: "+data +"\n")
> frm.output.Refresh()
> lock.release()
> if frm.killflag:
> thread.exit_thread()
> data = s.recv(1024)
> File "E:\Program files\python\lib\socket.py", line 165, in _dummy
> raise error(EBADF, 'Bad file descriptor')
> socket.error: [Errno 9] Bad file descriptor
> Unhandled exception in thread started by <function send at
> 0x0000000003652898>
> also: how can i write something like this without using global variables?
So, what did this have to do with wxPython? If you do use threads in
wx, you'll want to read this wiki page:
hi everyone,
i am trying to write a small chat, to get to know mutlithreading and sockets, but i keep getting this exception, and i have no idea how to deal with it.
can somebody help me out? the function that is giving me trouble is below
def listen():
global s
global lock
global frm
data = ""
while True:
data = s.recv(1024)
lock.acquire()
frm.output.AppendText("server: "+data +"\n")
frm.output.Refresh()
lock.release()
if frm.killflag:
thread.exit_thread()
data = s.recv(1024)
File "E:\Program files\python\lib\socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor
Unhandled exception in thread started by <function send at 0x0000000003652898>
This is OT for this group, but has the socket been connect()ed or accept()ed?
also: how can i write something like this without using global variables?
One way would be to pass the values as parameters to the function.
On Tue, Jun 16, 2009 at 6:43 AM, Jan-Heiner Dreschhoff<hdreschhoff@gmail.com> wrote:
hi everyone,
i am trying to write a small chat, to get to know mutlithreading and
sockets, but i keep getting this exception, and i have no idea how to deal
with it.
can somebody help me out? the function that is giving me trouble is below
def listen():
global s
global lock
global frm
data = ""
while True:
data = s.recv(1024)
lock.acquire()
frm.output.AppendText("server: "+data +"\n")
frm.output.Refresh()
lock.release()
if frm.killflag:
thread.exit_thread()
data = s\.recv\(1024\)
File "E:\Program files\python\lib\socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor
Unhandled exception in thread started by <function send at
0x0000000003652898>
also: how can i write something like this without using global variables?