Re: [Python] Problema script python con ReportLab
Ciao Samuele On Sun, Jun 15, 2008 at 23:40, Zanon Samuele [EMAIL PROTECTED] wrote: Scusate... mi è partito il messaggio senza allegato... eccolo... 2008/6/15 Zanon Samuele [EMAIL PROTECTED]: -MySQL -utf-8 -in teoria si -In allegato trovato lo script Come toverete nello script, che le stringhe di testo estratte dal database ho provato a fare un encode in utf-8 tramite il metodo .encode delle stringhe. provate a vedere se c'è un errore o qualcosa per poter sistemare la cosa... grazie mille Uhm, evidentemente alcuni (o tutti) i dati nel tuo DB non sono UTF8. Potresti provare con altre codifiche. Oppure, se i dati sporchi sono pochi, potresti usare il secondo parametro di encode, magari con il valore xmlcharrefreplace: help(unicode.encode) Help on method_descriptor: encode(...) S.encode([encoding[,errors]]) - string or unicode Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors. Ti consiglio di leggerti i diversi ottimi tutorial su unicode in python. Uno lo trovi anche sul sito di Reportlab: http://www.reportlab.com/i18n/python_unicode_tutorial.html Happy hacking, (c) -- Carlo C8E Miron Fscking Unicode Solution Architect™ http://www.linkedin.com/in/carlomiron http://pycon.it/ http://stacktrace.it/ http://pydinner.org/ ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] Problema script python con ReportLab
ok... trovato l'errore era una lettera accentata che dava problemi. come posso fargliela accettare dallo script? 2008/6/14 Carlo C8E Miron [EMAIL PROTECTED]: Ciao Samuele, On Fri, Jun 13, 2008 at 22:43, Zanon Samuele [EMAIL PROTECTED] wrote: Ciao a tutti... Ho fatto uno script per la creazione di un report con un elenco di contatti. quando lo eseguo però mi da un errore: Creazione Report Traceback (most recent call last): [...] File /usr/lib/python2.5/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-8: unsupported Unicode code range lo script esegue una connessione ad un database per recuperare i dati e con un ciclo for creo la tabella. Sembrerebbe che il tuo database non sia utf8, o contenga dati errati. come posso risolvere il problema? in allegato vi metto lo script. Quale allegato? :) scusate... mi ero dimenticato di metterlo. ciao e grazie mille per l'aiuto. Ciao, (c) -- Carlo C8E Miron Open Source Solution Architect http://www.linkedin.com/in/carlomiron http://pycon.it/ http://stacktrace.it/ http://pydinner.org/ ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python -- Zanon Samuele mailto:[EMAIL PROTECTED] ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] Problema script python con ReportLab
On Sat, Jun 14, 2008 at 09:29, Zanon Samuele [EMAIL PROTECTED] wrote: ok... trovato l'errore era una lettera accentata che dava problemi. come posso fargliela accettare dallo script? Mah, io mi inginocchierei sui ceci e proverei a chiederglielo per favore... (c) -- Carlo C8E Miron Open Source Solution Architect http://www.linkedin.com/in/carlomiron http://pycon.it/ http://stacktrace.it/ http://pydinner.org/ ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] Problema script python con ReportLab
altre sluzioni? grazie mille Il 14 giugno 2008 15.22, Carlo C8E Miron [EMAIL PROTECTED] ha scritto: On Sat, Jun 14, 2008 at 09:29, Zanon Samuele [EMAIL PROTECTED] wrote: ok... trovato l'errore era una lettera accentata che dava problemi. come posso fargliela accettare dallo script? Mah, io mi inginocchierei sui ceci e proverei a chiederglielo per favore... (c) -- Carlo C8E Miron Open Source Solution Architect http://www.linkedin.com/in/carlomiron http://pycon.it/ http://stacktrace.it/ http://pydinner.org/ ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python -- Zanon Samuele mailto:[EMAIL PROTECTED] ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
[Python] Problema script python con ReportLab
Ciao a tutti... Ho fatto uno script per la creazione di un report con un elenco di contatti. quando lo eseguo però mi da un errore: Creazione Report Traceback (most recent call last): File ./stampaPdfCoristi.py, line 136, in module main() File ./stampaPdfCoristi.py, line 134, in main doc.build(Report) File /usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py, line 740, in build self.handle_flowable(flowables) File /usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py, line 638, in handle_flowable if frame.add(f, self.canv, trySplit=self.allowSplitting): File /usr/lib/python2.5/site-packages/reportlab/platypus/frames.py, line 141, in _add w, h = flowable.wrap(aW, h) File /usr/lib/python2.5/site-packages/reportlab/platypus/tables.py, line 978, in wrap self._calc(availWidth, availHeight) File /usr/lib/python2.5/site-packages/reportlab/platypus/tables.py, line 526, in _calc self._calc_width(availWidth,W=W) File /usr/lib/python2.5/site-packages/reportlab/platypus/tables.py, line 389, in _calc_width t = self._elementWidth(v,s) File /usr/lib/python2.5/site-packages/reportlab/platypus/tables.py, line 432, in _elementWidth return max([stringWidth(x,fontName,fontSize) for x in v]) File _rl_accel.c, line 1102, in stringWidthU File _rl_accel.c, line 1149, in _instanceStringWidthU File /usr/lib/python2.5/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-8: unsupported Unicode code range lo script esegue una connessione ad un database per recuperare i dati e con un ciclo for creo la tabella. come posso risolvere il problema? in allegato vi metto lo script. ciao e grazie mille per l'aiuto. -- Zanon Samuele mailto:[EMAIL PROTECTED] ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] Problema script python con ReportLab
Ciao Samuele, On Fri, Jun 13, 2008 at 22:43, Zanon Samuele [EMAIL PROTECTED] wrote: Ciao a tutti... Ho fatto uno script per la creazione di un report con un elenco di contatti. quando lo eseguo però mi da un errore: Creazione Report Traceback (most recent call last): [...] File /usr/lib/python2.5/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-8: unsupported Unicode code range lo script esegue una connessione ad un database per recuperare i dati e con un ciclo for creo la tabella. Sembrerebbe che il tuo database non sia utf8, o contenga dati errati. come posso risolvere il problema? in allegato vi metto lo script. Quale allegato? :) ciao e grazie mille per l'aiuto. Ciao, (c) -- Carlo C8E Miron Open Source Solution Architect http://www.linkedin.com/in/carlomiron http://pycon.it/ http://stacktrace.it/ http://pydinner.org/ ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
[Python] Problema in Python
Salve, ho un problema con Python. Premetto che sto lavorando con PL/Python che e' una estensione Python che consente di importare/eseguire DDL scritte in python all’interno di un DB postgres. Quindi sto creando funzioni scritte in PL/Python (la documentazione di PL/Python è visibile qui: http://www.postgresql.org/docs/8.2/interactive/plpython.html) Il problema è il seguente: devo creare una funzione in PL/Python che mi permette di accedere (sia in lettura che in scrittura) al codice sorgente di tutti gli oggetti presenti in quel database. Per oggetti si intendono funzioni, funzioni trigger, procedure, sequenze, tabelle, viste. etc. Come posso fare? Grazie a chiunque mi fornirà una risposta. Naviga e telefona senza limiti con Tiscali Scopri le promozioni Tiscali adsl: navighi e telefoni senza canone Telecom http://abbonati.tiscali.it/adsl/ ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] Problema in Python
[EMAIL PROTECTED] ha scritto: Salve, Salve a te. ho un problema con Python. Premetto che sto lavorando con PL/Python che e' una estensione Python che consente di importare/eseguire DDL scritte in python all’interno di un DB postgres. Quindi sto creando funzioni scritte in PL/Python (la documentazione di PL/Python è visibile qui: http://www.postgresql.org/docs/8.2/interactive/plpython.html) Il problema è il seguente: devo creare una funzione in PL/Python che mi permette di accedere (sia in lettura che in scrittura) al codice sorgente di tutti gli oggetti presenti in quel database. Codice sorgente non credo sia il termine più appropriato. Per oggetti si intendono funzioni, funzioni trigger, procedure, sequenze, tabelle, viste. etc. Come posso fare? Grazie a chiunque mi fornirà una risposta. Questo ha poco a che fare con Python: http://www.postgresql.org/docs/8.2/static/information-schema.html http://www.postgresql.org/docs/8.2/static/catalogs.html Tieni conto che con PL/Python non hai un accesso ad oggetti al database. L'interfaccia è sempre la stessa: SQL. Saluti Manlio Perillo ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python