[Scons-users] scons 3.0.1: 'ascii' codec can't decode

Bill Deegan bill at baddogconsulting.com
Wed Nov 29 10:27:26 EST 2017


Yes.
That's some logic from the py2/3 port that's not quite right it seems.

Very surprised our test suite didn't catch something this simple.
I'll take a look at the logic.
I have a fix for similar in one of my sandboxes, but it's breaking a lot of
the tests (which themselves could be wrong), thought that fix is for py3.5+
issue.

In essence, all info used to create a signature from files/values/etc
should be bytes and not unicode and not treated as a string.
Looks like the code is not doing that in at least 2 places.

-Bill

On Wed, Nov 29, 2017 at 3:47 AM, <mpac1234 at will-hier-weg.de> wrote:

> Hi Tim,
>
> thanks for your reply. As far as I can see get_contents calls
> get_text_contents
> scons\engine\scons\node\python.py(166)get_csig()
> 165 pass
> --> 166 contents = self.get_contents()
> 167 self.get_ninfo().csig = contents
>
> scons\engine\scons\node\python.py(143)get_contents()
> 142 def get_contents(self):
> --> 143 text_contents = self.get_text_contents()
> 144 try:
>
> scons\engine\scons\node\python.py(135)get_text_contents()
> 134 contents = str(self.value)
> --> 135 for kid in self.children(None):
> 136 contents = contents + kid.get_contents().decode()
>
> Is not the root problem to represent arbitrary data as ASCII? This is how
> this stuff looks like in SCons 2.5.1:
> --------------
> for kid in self.children(None):
> contents = contents + kid.get_contents()
> return contents
>
> get_contents = get_text_contents ###TODO should return 'bytes' value
> --------------
> get_contents and get_text_contents are the same. No attempts to decode /
> encode.
>
>
>
> > Gesendet: Dienstag, 28. November 2017 um 18:02 Uhr
> > Von: "Tim Jenness" <tjenness at lsst.org>
> > An: "SCons users mailing list" <scons-users at scons.org>
> > Betreff: Re: [Scons-users] scons 3.0.1: 'ascii' codec can't decode
> > That line came up the other day with a different bug. I was wondering
> why it wasn’t using `kid.get_text_contents()`.
> >
> > > On Nov 28, 2017, at 08:26 , <mpac1234 at will-hier-weg.de> <
> mpac1234 at will-hier-weg.de> wrote:
> > >
> > >
> > > I do not know why or how, but it seems the binary content of files
> appears as a python string in SCons/engine/node/Python.py:136 and
> decoding this as ascii fails.
> > > Changing SCons/engine/Node/Python.py:135,136 from
> > > for kid in self.children(None):
> > > contents = contents + kid.get_contents().decode()
> > > to
> > > for kid in self.children(None):
> > > contents = contents + kid.get_contents().encode('hex').decode()
> > > makes the errors ('ascii' codec can't decode byte xxxx in position x:
> ordinal not in range(128)) disappear. But I have no idea if this is a valid
> fix or if it breaks anything else.
> > >
> > >
> > > _______________________________________________
> > > Scons-users mailing list
> > > Scons-users at scons.org
> > > https://imsva91-ctp.trendmicro.com:443/wis/
> clicktime/v1/query?url=https%3a%2f%2fpairlist4.pair.net%
> 2fmailman%2flistinfo%2fscons%2dusers&umid=4DD1EB76-5F0C-
> A405-82E3-C262848FEB2B&> auth=f95e8f518a5a1451e680168b3f9df426ddd6fc8e-
> ded3bf46fcf4237a27f3aaeff727822f03e7c624
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20171129/af028c1f/attachment.html>


More information about the Scons-users mailing list