Re: python 2.6 ascii codec error

[email protected] Sun, 22 Nov 2009 22:00:08 -0800
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Fri, 20 Nov 2009, kevin wrote:

> i am trying to move to python 2.6 and latest cheetah 2.4. i am getting
> this error with python 2.6 and cheetah 2.4.
> the same template was working well with python 2.5 and cheetah 2.0.1.
> thanks for the help

Apologies for the late reply. To your issue, the biggest change between Cheetah
2.0.1 and Cheetah 2.4 was the Cheetah 2.2 release which changed all strings
internally to use unicode objects instead of a hodge podge of unicode and str
objects of various encodings. 

Looks like you're using Web.py and I would double check that something else
isn't mucking with the encoding of the str object prior to passing it along to
your cheetah wrapper.

Additionally, are you using #encoding or #unicode at all in your strings? 

Any more details you can provide would be helpful.

>   File "/home/mark/work/common/web/cheetah.py", line 95, in render

I recognize this path, something about it says "BidEgg" to me

>     compiled_tmpl = _compiletemplate(template, base=base, isString=isString)
>   File "/home/mark/work/common/web/utils.py", line 387, in __call__
>     update(block=True)
>   File "/home/mark/work/common/web/utils.py", line 382, in update
>     self.cache[key] = (self.func(*args, **keywords), time.time())
>   File "/home/mark/work/common/web/cheetah.py", line 41, in __compiletemplate
>     tmpl_compiler = Compiler(source=text, mainClassName='GenTemplate')
>   File "/usr/lib64/python2.6/site-packages/Cheetah-2.4.0-py2.6-linux-x86_64.egg/Cheetah/Compiler.py",
> line 1588, in __init__
>     source = unicode(source)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
> 7550: ordinal not in range(128)

Cheers,
-R. Tyler Ballance
--------------------------------------
 Jabber: [email protected]
 GitHub: http://github.com/rtyler
Twitter: http://twitter.com/agentdero
   Blog: http://unethicalblogger.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAksKJOgACgkQFCbH3D9R4W9DkQCfcSeCSgs5PvOYcoyQUGZe3DPj
GKYAmwW4bQYbue7cmMaS0hwVff4tXWXt
=NBsj
-----END PGP SIGNATURE-----