Strange Telnet error

Tim Roberts timr at probo.com
Fri Sep 20 06:23:44 CEST 2002


mnations at airmail.net (Marc) wrote:
>
>I have been running some code that all the sudden stopped working. I
>can not figure out what's happened. I am doing a simple telnet
>connection that sends and receives info. Now I am getting this error:
>
>Traceback (most recent call last):
>  File "C:\Python22\lib\threading.py", line 408, in __bootstrap
>    self.run()
>  File "C:\Python22\lib\threading.py", line 396, in run
>    apply(self.__target, self.__args, self.__kwargs)
>  File "main.py", line 85, in run
>    command[0](*command[1:3])
>  File "key.py", line 92, in command
>    conn.write(com)
>  File "C:\python22\lib\telnetlib.py", line 272, in write
>    self.sock.sendall(buffer)
>AttributeError: 'int' object has no attribute 'sendall'
>
>Has anyone ever seen this before? If so, what could do this be related
>to?

I'm guessing you continued to try to do work after closing the connection.
Note this code at line 247:

    def close(self):
        """Close the connection."""
        if self.sock:
            self.sock.close()
        self.sock = 0    # <<<< this makes self.sock an integer
        self.eof = 1

Your code is multithreaded.  Could another thread have closed the socket on
you?
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list