problem writing to file

Christian Maus maus at netz.klinik.uni-mainz.de
Mon May 14 10:57:39 EDT 2001


Hi, 

I have a strange problem when I try to write to a file. I created a list
named named new_ldapentries. I create a file object in write mode: 
		testfile = open('/tmp/testfile', 'w')
then I go through the elements of my list and try to write them to the
file:
		for i in range(len(new_ldapentries)):
			testfile.write(new_ldapentries[i])
		testfile.close()
When I run the script I get the following error:
		Exception in Tkinter callback
		Traceback (innermost last):
  		  File "/usr/lib/python1.5/lib-tk/Tkinter.py", line 764, in __call__
    		    return apply(self.func, args)
  		  File "python/emailmanager.py", line 333, in writeLDAPentry
    		    testfile.write(new_ldapentries[line])
		TypeError: read-only buffer, instance

The strange thing is when I replace the new_ldapentries[line] with any
String like 'hello' everything works fine.

Has anybody a idea where I made a mistake?
Thanks in advance, christian
-- 
Networking Group, Hospital of Johannes Gutenberg-University
Obere Zahlbacher Straße 69, 55101 Mainz, Germany
tel: +49 (0)6131 17-7193	FAX: +49 (0)6131 17-477193



More information about the Python-list mailing list