Author eric.smith
Recipients eric.smith, ezio.melotti, flox, hct, mark.dickinson, meador.inge, python-dev, r.david.murray
Date 2014-03-19.20:30:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395261056.89.0.999212235066.issue7994@psf.upfronthosting.co.za>
In-reply-to
Content
Or:

"{:{:s}{:d}s}".format(str(self.pcs), self.format_align, self.max_length)

You're trying to apply the string format specifier (the stuff after the first colon through the final "s", as expanded) to an object that's not always a string: sometimes it's None. So you need to use one of the two supported ways to convert it to a string. Either str() or !s.

str.format() is very much dependent on the types of its arguments: the format specifier needs to be understood by the object being formatted. Similarly, you couldn't pass in a datetime and expect that to work, either.
History
Date User Action Args
2014-03-19 20:30:56eric.smithsetrecipients: + eric.smith, mark.dickinson, ezio.melotti, r.david.murray, flox, meador.inge, python-dev, hct
2014-03-19 20:30:56eric.smithsetmessageid: <1395261056.89.0.999212235066.issue7994@psf.upfronthosting.co.za>
2014-03-19 20:30:56eric.smithlinkissue7994 messages
2014-03-19 20:30:56eric.smithcreate