Skip to content

Conversation

@jonas0616
Copy link

@jonas0616 jonas0616 commented Aug 15, 2017

In the tutorial, we can change the output style via set_style(), and MSWORD_FRIENDLY is one of the styles which can be imported as following:

from prettytable import MSWORD_FRIENDLY

It also mentioned there are another styles, e.g., PLAIN_COLUMNS. However, it failed to import via the same way.

from prettytable import PLAIN_COLUMNS

result:

Traceback (most recent call last):
  File "./pptest.py", line 3, in <module>
    from prettytable import PLAIN_COLUMNS
ImportError: cannot import name PLAIN_COLUMNS

I am unable to solve it until tracing the source code, and change to the following import statement:

from prettytable.prettytable import PLAIN_COLUMNS

I am of the opinion that it should automatically load all exported styles instead of only partial ones. If not, it should then add some notes in tutorial to clarify the usage.

@coveralls
Copy link

coveralls commented Aug 15, 2017

Coverage Status

Coverage increased (+0.02%) to 77.488% when pulling dbbeb25 on jonas0616:export-style-name into 4676e41 on kxxoling:master.

@hugovk
Copy link
Contributor

hugovk commented Nov 1, 2020

Tip: this is fixed in upstream PrettyTable.

https://github.com/jazzband/prettytable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants