[Vobject] I can't write cal to a file

Didier BRETIN didier at bretin.net
Fri Jul 13 00:25:46 CDT 2007


Hi,

I generate a calendar from data read from an unicode xml file.
I can create all my events (thanks Jeffrey :)), and then I would
like to write in a file the serialized calendar.

And I got this error:
Traceback (most recent call last):
   File "C:\Documents and Settings\dbretin\Mes 
documents\perso\tudumo\tudumo.py",  line 113, in <module>
     t.save()
   File "C:\Documents and Settings\dbretin\Mes 
documents\perso\tudumo\tudumo.py", line 49, in save
     self.cal.write()
   File "C:\Documents and Settings\dbretin\Mes 
documents\perso\tudumo\tudumo.py", line 70, in write
     f.write(stream)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 
283: ordinal not in range(12
8)

To write my file I do this:
	def write(self):
		f = open(self.file, 'wb')
		stream = self.cal.serialize()
		f.write(stream)
		f.close()

Do you have an idea why I have this error ?

Regards.
-- 
Didier BRETIN
http://www.bretin.net/



More information about the VObject mailing list