Re: [GRASS-dev] [Issue] String formatting issue

2018-06-04 Thread Martin Landa
Hi, 2018-06-04 19:52 GMT+02:00 Sanjeet : > Yes, the .format() style should be followed in most cases. I could be > wrong but I guess the old style has been used to support older > versions of Python. But it seems we can use the 'format' style since > we are only keeping support for Python 2.7 (or

Re: [GRASS-dev] [Issue] String formatting issue

2018-06-04 Thread Sanjeet
On Mon, Jun 4, 2018 at 3:54 AM, Nikos Alexandris wrote: > * Sanjeet [2018-06-03 18:08:29 -0600]: >> >> 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()"

Re: [GRASS-dev] [Issue] String formatting issue

2018-06-04 Thread Sanjeet
On Mon, Jun 4, 2018 at 1:58 AM, Maris Nartiss wrote: > Hi Sanjeet, > try like this: > > msg = _("Bla bla {0} with {1}").format(zero, one) > Hi Maris, I tried and it worked too. Thanks, Sanjeet ___ grass-dev mailing list grass-dev@lists.osgeo.org

Re: [GRASS-dev] [Issue] String formatting issue

2018-06-04 Thread Nikos Alexandris
* Sanjeet [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

Re: [GRASS-dev] [Issue] String formatting issue

2018-06-04 Thread Maris Nartiss
Hi Sanjeet, try like this: msg = _("Bla bla {0} with {1}").format(zero, one) Māris. 2018-06-04 3:08 GMT+03:00 Sanjeet : > 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

[GRASS-dev] [Issue] String formatting issue

2018-06-03 Thread Sanjeet
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