seckcoder / prettytable

Automatically exported from code.google.com/p/prettytable
Other
0 stars 0 forks source link

only return printt #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
when i call pt.printt(sort='something')

it's only return "printt"

and it's not happen at 0.5 version

Original issue reported on code.google.com by peter.p...@haylix.com on 9 May 2012 at 4:55

GoogleCodeExporter commented 9 years ago
printt() has been removed in PrettyTable 0.6.  To print a table, you now just 
pass the result of get_string() to Python's built in printing function.  In 2.x:

print pt.get_string(sort='something')

and in 3.x:

print(pt.get_string(sort='something'))

This was done mostly to make the code simultaneously compatible with Python 2.x 
and 3.x.  Also, it really was a bit silly having a method which simply used the 
in-built print to display the result of another function.

get_string() and printt() have always accepted the same keyword arguments, so 
you should simply be able to do a search-and-replace on an existing codebase 
and have things work no problem.

Finally, could you clarify what you mean by saying that your code returns 
"printt"?  There is no printt method in the 0.6 code so it should not be 
possible for a printt call to return anything.  For me, calling printt on a 0.6 
table raises an AttributeError in 2.x and 3.x.  Does this happen for you?  If 
you really are getting a string "printt" back from the code you posted, I'm 
very confused and would like to know more.

Original comment by luke@maurits.id.au on 9 May 2012 at 8:15

GoogleCodeExporter commented 9 years ago
Closing as invalid due to lack of further details and original problem arising 
from misusing 0.6 API.

Original comment by luke@maurits.id.au on 17 May 2012 at 2:15