newbie: TypeError

Arend van der Boom avdboom at kabelfoon.nl
Mon Sep 17 15:29:00 EDT 2001


Hi,

I have a problem with extracting some text from a error

<code snippet>

try:
  ftp = ftplib.FTP(ip_number)
  welcome = ftp.getwelcome()
  ftp.close()
  # 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 - http://home.kabelfoon.nl/~avdboom 
  vKGG   - http://www.vkgg.nl



More information about the Python-list mailing list