ODBC error trap resolved! Now...

Daley, MarkX markx.daley at intel.com
Thu Apr 27 17:10:50 EDT 2000


OK, so the error trapping is good, but now I run into an append problem.  I
have a list defined in the beginning of the function, like so:

servername = ['ServerA', 'ServerB', 'ServerC']
for index in servername:
	try:
		#Big routine to collect and write data to a file.
	except dbi.opError:
		servername.append(index)

So, if one of the servers doesn't make the connection, it gets added to the
end of the list until it does connect.  This worked great in my test
scripts, but when put to practice, I get this:

Traceback (innermost last):
  File "<pyshell#1>", line 1, in ?
    collect.collect()
  File "C:\PROGRA~1\Python\collect.py", line 51, in collect
    servername.append(index)
AttributeError: 'string' object has no attribute 'append'

I didn't see this when I tested my append function.  What do I not
understand about lists in this context?

Once again, thank you for all your help in advance.

- Mark





More information about the Python-list mailing list