Replace weird error message?

Dan Strohl D.Strohl at F5.com
Wed Mar 16 14:53:04 EDT 2016


Actually, I think that was the complete code... give it a try...

"{:02}".format("1")

produces the error listed.

I agree the error is not very clear, since the "=" was not passed, it seems like an incorrect error.  What about something like:

"ValueError: '=' and '0' padding are not allowed in string format specifiers"

> -----Original Message-----
> From: Python-list [mailto:python-list-bounces+d.strohl=f5.com at python.org]
> On Behalf Of Joel Goldstick
> Sent: Wednesday, March 16, 2016 11:39 AM
> Cc: python-list at python.org
> Subject: Re: Replace weird error message?
> 
> can you show the complete code?  It doesn't start with "{:02} I don't think
> 
> On Wed, Mar 16, 2016 at 2:34 PM, the.gerenuk--- via Python-list < python-
> list at python.org> wrote:
> 
> > The following error message, makes it a bit hard to understand what
> > went wrong
> >
> > >>> "{:02}".format("1")
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > ValueError: '=' alignment not allowed in string format specifier
> >
> > (this can happen easily if you read in text files and forget to
> > convert)
> >
> > Do you think some better error message should be used?
> >
> > For example a hint that "0" does work for the given argument.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> 
> 
> 
> --
> Joel Goldstick
> http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
> http://cc-baseballstats.info/
> --
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list