question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

breaking on python 2;

See original GitHub issue

This seems to be breaking on python 2.

>>> import beautifultable
>>> t = beautifultable.BeautifulTable()
>>> t.column_headers = ["a", "b", "c"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/russ/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beautifultable/beautifultable.py", line 231, in __setattr__
    super(BeautifulTable, self).__setattr__(name, value)
  File "/Users/russ/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beautifultable/beautifultable.py", line 366, in column_headers
    raise TypeError("Headers should be of type 'str', not {}".format(type(i)))
TypeError: Headers should be of type 'str', not <type 'str'>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pri22296commented, Oct 19, 2019

@jayvdb Python2 support will be dropped in the next release. It’s going EOL so there is no point in suporting it. I’ll make some cleanup changes in travis, tox, etc in a future commit.

1reaction
pri22296commented, Jan 4, 2019

In v0.6.0, there is a constraint that all strings must be unicode as mentioned here. This wasn’t in previous versions and will again be removed in v0.7.0

So in this case you can either replace

t.column_headers = ["a", "b", "c"]

with

t.column_headers = [u"a", u"b", u"c"]

or add

from __future__ import unicode_literals

at the top of the file as a temporary fix.

You could also downgrade to v0.5.3 if you do not need features added in v0.6.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I break out of multiple loops? - Stack Overflow
Introduce a new variable that you'll use as a 'loop breaker'. First assign something to it(False,0, etc.), and then, inside the outer loop,...
Read more >
https://docs.python.org/2/tutorial/controlflow.html
No information is available for this page.
Read more >
Python break and continue (With Examples) - Programiz
The break statement is used to terminate the loop immediately when it is encountered. The syntax of the break statement is: break. Working...
Read more >
Python break statement - Tutorialspoint
It terminates the current loop and resumes execution at the next statement, just like the traditional break statement in C. The most common...
Read more >
GitHub Actions Breaking Change: Python 2 being removed ...
Starting April 6, 2020, Python 2 will no longer be offered on any hosted virtual environments. Python 2 was sunset on January 1,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found