newbie: TypeError

Arend van der Boom avdboom at
Mon Sep 17 21:29:00 CEST 2001


I have a problem with extracting some text from a error

<code snippet>

  ftp = ftplib.FTP(ip_number)
  welcome = ftp.getwelcome()
  # for debug purposes
  raise ftplib.error_temp, 'Raise ERROR'
except ftplib.error_temp, detail:
  print detail
  welcome = detail

s = re.compile('Raise',re.I)
part = s.findall(welcome)
print part

</code snippet>

Printing the error (detail) works oke, but when I want to search for
a string in the error messages, I always get an TypeError:
'expected string of buffer' at the findall part.

When there is no exception, everything works oke.

Somehow I need to convert 'detail', an instance, to a buffer or string
I tried several things, but I can not get it right.

What am I doing wrong ??

Arend van der Boom
#--/\---------^-^-^-^-^-----  - -//-~~>      
Homepage - 
  vKGG   -

More information about the Python-list mailing list