What's the best/neatest way to get Unicode data from a database into a grid cell?
Chris Angelico
rosuav at gmail.com
Mon Feb 8 05:57:29 EST 2016
On Mon, Feb 8, 2016 at 9:22 PM, <cl at isbd.net> wrote:
>> Once you switch to Python 3 and Phoenix you have to modify this
>> slightly, e.g. by adding this to the top of your code:
>>
>> try:
>> basestring
>> except:
>> basestring = (bytes,str)
>>
> Everything else is 3 compatible so moving should be fairly painless
> if/when phoenix becomes available.
Small point: Even for code as small as this, I would be inclined to
catch only the one exception you care about - in this case, NameError.
I try to avoid having a bare except clause anywhere other than a "log
and continue" or "react and reraise" kind of situation.
ChrisA
More information about the Python-list
mailing list