Kept getting "TypeError: 'in <string>' requires string as left operand"

I am new in Python programming, and have been having trouble with the
following error.

I have been trying to run the "WxHowtoSmallTelnetClient" code I got from
wxPyWiki. I could get the telnet window launched, but when I entered text in
the command frame, the following error displayed in the Interactive Window
on Pythonwin, and nothing got pass to the telnet session.

Traceback (most recent call last):
  File "C:\Python23\telnet_c2.py", line 61, in OnEnter
    self.tn.write(e.GetString() + "\n")
  File "C:\Python23\lib\telnetlib.py", line 289, in write
    if IAC in buffer:
TypeError: 'in <string>' requires string as left operand

Please help.

Sincere,
Man

···

*****

This email may contain confidential, privileged and protected information from disclosure. Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

*****

Traceback (most recent call last):
  File "C:\Python23\telnet_c2.py", line 61, in OnEnter
    self.tn.write(e.GetString() + "\n")
  File "C:\Python23\lib\telnetlib.py", line 289, in write
    if IAC in buffer:
TypeError: 'in <string>' requires string as left operand

I saw this problem when I was using Python 2.2; in 2.3 it works fine. But
basically 'if str in string' won't work if 'str' isn't a single character.
In 2.3, it will take character strings.

Quick solution: use .find() or .index().