eight - Python 2/3 porting helper

raw JSON →
1.0.1 verified Mon Apr 27 auth: no python maintenance

A lightweight porting helper library for writing Python 2/3 compatible code. Current version 1.0.1, stable and maintained as needed.

pip install eight
error ImportError: No module named builtins
cause future package not installed or not in path.
fix
pip install future
error AttributeError: module 'future.builtins' has no attribute 'str'
cause Incorrect import of future.builtins instead of using eight's imports.
fix
Use: from eight import str
deprecated eight v1.0.1 removed the deprecated 'dummy_thread' symbol from Python 2's dummy_thread module.
fix Use 'from future.utils import with_metaclass' or import dummy_thread directly if needed.
gotcha eight relies on the 'future' library. Ensure future is installed and up-to-date (>=0.16) to avoid import errors.
fix Run: pip install 'future>=0.16'
gotcha Do not mix 'six' and 'eight' imports. They may conflict.
fix Stick to one compatibility library.

Import future and eight for Python 2/3 compatible builtins.

from future.builtins import *
from eight import *
# Now you can write Python 3 code that works on Python 2
print(str('hello'))