unbound methods

B

brent.chambers

I wrote a small class today at work playing with sockets in command
line windows. When attempting to call the handle function, I get a
TypeError. "Unbound method handle() must be called with connection
instance as first argument (got nothing instead). Any suggestions
would be greatly appreciated. Thanks!

-chase
 
M

Marc 'BlackJack' Rintsch

In <[email protected]>,
I wrote a small class today at work playing with sockets in command
line windows. When attempting to call the handle function, I get a
TypeError. "Unbound method handle() must be called with connection
instance as first argument (got nothing instead). Any suggestions
would be greatly appreciated. Thanks!

I'd suggest that you post some actual code plus traceback so we don't have
to guess.

Ciao,
Marc 'BlackJack' Rintsch
 
P

Peter Otten

I wrote a small class today at work playing with sockets in command
line windows. When attempting to call the handle function, I get a
TypeError. "Unbound method handle() must be called with connection
instance as first argument (got nothing instead). Any suggestions
would be greatly appreciated. Thanks!

That happens if you call a (normal) method on the class instead of on an
instance.
.... def method(self, *args): print args
....

This works:
(42,)

while this doesn't:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unbound method method() must be called with A instance as first
argument (got int instance instead)

For details you need to post some code illustrating the problem.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top