Eric V. Smith added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to