On Jun 28, 2019, at 12:30 PM, john fabiani <[email protected]> wrote:
>
> I often use dataSet's in memory. Such as 'dataDS.execute("select * from
> dataset order by pkid")' where dataDS = an existing dataset. The issue
> becomes that for some reason the query returns a value as "b('330')".
> Therefore, strVal becomes "b(330')" this causes Decimal(strVal) to fail. I
> added the code below and it works.
>
> I don't have a clue why or what is the root cause. But I wonder if some
> change has occurred in sqlite for python3. I think this maybe only fixing a
> symptom.
Python3 uses bytes by default, and relies on the developer to handle the
decoding.
> if isinstance(strVal, bytes):
> strVal = strVal.decode("utf-8”)
It might be better to write this as:
if isinstance(strVal, bytes):
strVal = strVal.decode(dabo.getEncoding())
Other users may have a different default encoding for their locale.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/[email protected]