* Sanjeet <[email protected]> [2018-06-03 18:08:29 -0600]:
Hi everyone,
I came across this type error while porting libs.
msg = _("Module run %s %s ended with error") % (module, code)
TypeError: %b requires a bytes-like object, or an object that
implements __bytes__, not 'NoneType'
This uses % format specifier which sometimes fails on Python 3 because
of strings and bytes differences.
I can resolve this by using fomat() like this:
msg = _(("Module run {} {} ended with error").format(module,code))
Do you think this is a good way to resolve this?
Is "format()" going to work well with translations using the
''gettext()'' used as _() as shown in the above line?
Thanks,
Sanjeet
Normally everyone would want to follow the "new" style of formatting strings, which offers many more options. Why stick to the old style, i.e. using the % notation? Cheers, Nikos
signature.asc
Description: PGP signature
_______________________________________________ grass-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-dev
