[Tutor] extract uri from beautiful soup string

Norman Khine norman at khine.net
Mon Oct 15 01:17:42 CEST 2012

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>
TypeError: 'NoneType' object is not callable

On Mon, Oct 15, 2012 at 12:12 AM, Sander Sweers <sander.sweers at 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-nimes at aol.com',
>> mise en place d'ateliers, d'animations hebdomadaires et ponctuelles
>> afin de lutter contre toutes les formes d'exclusion., Mme Liberté
>> Bisbal,, 3002 Rte de Courbessac,, 30000
>> NIMES, Madame BISBAL Liberté,,  ]
>> [u'Social', u'Adapei30', u'contact at 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,, 30900 NIMES, Monsieur FLUTTE
>> Bernard,  ]
>> [u'Sport', u'Aero-club de nimes-courbessac', u'aeroclubnimes at free.fr',
>> promouvoir , de faciliter et d'organiser la pratique de l'aviation, 65
>> Aerodrome de Nimes Courbessac,, 30000 NIMES, Monsieur
>> How do I change to code to take note of the latin-1 encoding?
> _______________________________________________
> Tutor maillist  -  Tutor at 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" ] )

More information about the Tutor mailing list