i tried this: http://pastie.org/5059153
but now i get a Traceback (most recent call last): File "nimes_extract.py", line 75, in <module> c.writerow([item.encode("UTF-8")]) TypeError: 'NoneType' object is not callable On Mon, Oct 15, 2012 at 12:12 AM, Sander Sweers <sander.swe...@gmail.com> wrote: > Norman Khine schreef op zo 14-10-2012 om 23:10 [+0100]: >> One thing is that when I try to write the assoc_data into a CSV file, >> it groaks on >> >> UnicodeEncodeError: 'ascii' codec can't encode character u'\xc7' in position >> 0: > > It looks like python is doing an implicit decode/encode on one of your > strings. It may be caused in codecs.open. You will have to hunt down > where this implicit decode/encode is done, see > http://nedbatchelder.com/text/unipain.html for more info. > >> here some sample data from the print: > > These strings don't cause any errors for me and fit in ascii. Add some > print statements before your write the string to find which string is > causing you grief. > > Greets > Sander > >> [u'Social', u'Action9', u'ash-ni...@aol.com', >> mise en place d'ateliers, d'animations hebdomadaires et ponctuelles >> afin de lutter contre toutes les formes d'exclusion., Mme Liberté >> Bisbal, 04.66.27.24.84, 3002 Rte de Courbessac, 04.66.27.24.84, 30000 >> NIMES, Madame BISBAL Liberté, 04.66.27.24.84, ] >> [u'Social', u'Adapei30', u'cont...@adapi30.org', deux lieux d'echanges >> et d'infos des publics concernes par le probleme du handicap mental >> representation aupres de divers organismes d'etat et du departement., >> 17b, RUE CHILDEBERT, 04.66.21.21.49, 30900 NIMES, Monsieur FLUTTE >> Bernard, ] >> [u'Sport', u'Aero-club de nimes-courbessac', u'aeroclubni...@free.fr', >> promouvoir , de faciliter et d'organiser la pratique de l'aviation, 65 >> Aerodrome de Nimes Courbessac, 04.66.28.16.00, 30000 NIMES, Monsieur >> VASSAL PATRICK, ] >> >> How do I change to code to take note of the latin-1 encoding? > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor -- %>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] ) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor