Message from discussion
Issues with encodings
Date: Wed, 7 Nov 2012 16:28:30 -0800 (PST)
From: Doug Latornell <djlatorn...@gmail.com>
To: blogofile-discuss@googlegroups.com
Cc: QuickeneR <q...@tut.by>
Message-Id: <6d90b8b8-cdaf-41d4-9eab-f1cc49255f27@googlegroups.com>
In-Reply-To: <05C3A463-2884-4026-9959-F0FED74BE934@zzzcomputing.com>
References: <784d662b-c432-4e21-bf35-93d6c1b9ac97@googlegroups.com>
<BE9A3FE0-73E9-450C-BDAC-10886071CBAC@zzzcomputing.com>
<a8095d2b-a88c-46f2-a7c9-cd816b6b1fb5@googlegroups.com>
<05C3A463-2884-4026-9959-F0FED74BE934@zzzcomputing.com>
Subject: Re: Issues with encodings
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1747_17425601.1352334510905"
------=_Part_1747_17425601.1352334510905
Content-Type: multipart/alternative;
boundary="----=_Part_1748_9003363.1352334510905"
------=_Part_1748_9003363.1352334510905
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
On Thursday, November 1, 2012 10:00:52 AM UTC-4, Michael Bayer wrote:
>
>
> On Nov 1, 2012, at 7:29 AM, QuickeneR wrote:
>
> ----------------
>
> ERROR:blogofile:Fatal build error occured, calling
> bf.config.build_exception()
> Traceback (most recent call last):
> File "E:\Python33\Scripts\blogofile-script.py", line 9, in <module>
> load_entry_point('blogofile==0.8b1', 'console_scripts', 'blogofile')()
> File
> "e:\python33\lib\site-packages\blogofile-0.8b1-py3.3.egg\blogofile\main.py",
> line 58, in main
> args.func(args)
> File
> "e:\python33\lib\site-packages\blogofile-0.8b1-py3.3.egg\blogofile\main.py",
> line 388, in do_build
> writer.write_site()
> File
> "e:\python33\lib\site-packages\blogofile-0.8b1-py3.3.egg\blogofile\writer.py",
> line 50, in write_site
> self.__write_files()
> File
> "e:\python33\lib\site-packages\blogofile-0.8b1-py3.3.egg\blogofile\writer.py",
> line 127, in __write_files
> util.path_join(root, html_path))
> File
> "e:\python33\lib\site-packages\blogofile-0.8b1-py3.3.egg\blogofile\template.py",
> line 386, in materialize_template
> template = template_engine(template_name, caller=caller, lookup=lookup)
> File
> "e:\python33\lib\site-packages\blogofile-0.8b1-py3.3.egg\blogofile\template.py",
> line 114, in __init__ t_file.read(),
> File "e:\python33\lib\encodings\cp1251.py", line 23, in decode
> return codecs.charmap_decode(input,self.errors,decoding_table)[0]
> UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position
> 398: character maps to <undefined>
> ----------------------
>
>
> Well the bug here in Blogofile is that they aren't using Mako's routines
> to open a template file. We open it with mode='rb' so there's no need
> for it to attempt a decode. right where they say Template(t_file.read()),
> they should be saying Template(filename=t_file) so that Mako handles the
> details.
>
> I've created a ticket at
> https://github.com/EnigmaCurry/blogofile/issues/134 .
>
This has been fixed in
https://github.com/EnigmaCurry/blogofile/commit/61245b5ab2
>
> From the text here http://www.python.org/dev/peps/pep-0263/ , it looks
> like it is meant for python source files, not arbitrary text files.
>
>
> A Mako template file is a form of Python source file. You can't just
> send any random text to Mako.
>
> Just to confirm, the Mako engine standalone works as expected, correct ?
>
>
>
------=_Part_1748_9003363.1352334510905
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
On Thursday, November 1, 2012 10:00:52 AM UTC-4, Michael Bayer wrote:<block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div style=3D"word-wrap:break-word">=
<br><div><div>On Nov 1, 2012, at 7:29 AM, QuickeneR wrote:</div><br><blockq=
uote type=3D"cite"><div>----------------</div></blockquote><blockquote type=
=3D"cite"><div>ERROR:blogofile:Fatal build error occured, calling bf.config=
.build_exception() <br>Traceback (=
most recent call last): =
<br> File "E:\Python33\Scripts\<wbr>blog=
ofile-script.py", line 9, in <module> =
<br> load_entry_point('blogofile=3D=3D<wbr>0.8b1', 'c=
onsole_scripts', 'blogofile')() =
<br> File "e:\python33\lib\site-<wbr>packages\blogofile-0.8b1-py3.<wbr>3=
.egg\blogofile\main.py", line 58, in main <br> args.f=
unc(args) =
<br> File "e:\python33\lib\site-<wbr>pa=
ckages\blogofile-0.8b1-py3.<wbr>3.egg\blogofile\main.py", line 388, in do_b=
uild <br> writer.write_site() =
<br> F=
ile "e:\python33\lib\site-<wbr>packages\blogofile-0.8b1-py3.<wbr>3.egg\blog=
ofile\writer.py", line 50, in write_site <br> self.__write_fi=
les() =
<br> File "e:\python33\lib\site-<wbr>packages\bl=
ogofile-0.8b1-py3.<wbr>3.egg\blogofile\writer.py", line 127, in __write_fil=
es <br> util.path_join(root, html_path)) =
<br> File =
"e:\python33\lib\site-<wbr>packages\blogofile-0.8b1-py3.<wbr>3.egg\blogofil=
e\template.py", line 386, in materialize_template =
=
<br> template =3D template_engine(template_name, =
caller=3Dcaller, lookup=3Dlookup) =
<br> File "e:\python33\lib\site-<wbr>packages\blogofile-0.8b1-py3.=
<wbr>3.egg\blogofile\template.py", line 114, in __init__ t_file.read(), =
=
<br> File "e:\python33\lib\encodings\<wbr>cp12=
51.py", line 23, in decode =
<br> return codecs.charmap_decode(input,<wbr>self.errors,decoding=
_table)[0] <br>UnicodeDec=
odeError: 'charmap' codec can't decode byte 0x98 in position 398: character=
maps to <undefined> </div><div>----------------------</div></b=
lockquote><div><br></div><div>Well the bug here in Blogofile is that they a=
ren't using Mako's routines to open a template file. We open i=
t with mode=3D'rb' so there's no need for it to attempt a decode. ri=
ght where they say Template(t_file.read()), they should be saying Template(=
filename=3Dt_file) so that Mako handles the details.</div><div><br></div><d=
iv>I've created a ticket at <a href=3D"https://github.com/EnigmaCurry/=
blogofile/issues/134" target=3D"_blank">https://github.com/<wbr>EnigmaCurry=
/blogofile/issues/<wbr>134</a> .</div></div></div></blockquote><div><br>Thi=
s has been fixed in https://github.com/EnigmaCurry/blogofile/commit/61245b5=
ab2 <br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D"wo=
rd-wrap:break-word"><div><br><blockquote type=3D"cite"><div>From the text h=
ere <a href=3D"http://www.python.org/dev/peps/pep-0263/" target=3D"_blank">=
http://www.python.org/dev/<wbr>peps/pep-0263/</a> , it looks like it is mea=
nt for python source files, not arbitrary text files. </div></blockquote><d=
iv><br></div><div>A Mako template file is a form of Python source file. &nb=
sp; You can't just send any random text to Mako.</div><br></div>Just to con=
firm, the Mako engine standalone works as expected, correct ?<div><br></div=
><div><br></div></div></blockquote>
------=_Part_1748_9003363.1352334510905--
------=_Part_1747_17425601.1352334510905--