Reputation: 3702
I think this somehow related to installed Python, but I have no clue how to fix it.
This is what I have:
$ python --version
Python 2.7.12
$ pyftsubset
Traceback (most recent call last):
File "/usr/local/bin/pyftsubset", line 7, in <module>
from fontTools.subset import main
File "/usr/local/lib/python2.7/dist-packages/fontTools/__init__.py", line 1, in <module>
from fontTools.misc.py23 import *
File "/usr/local/lib/python2.7/dist-packages/fontTools/misc/__init__.py", line 3, in <module>
from fontTools.misc.py23 import *
File "/usr/local/lib/python2.7/dist-packages/fontTools/misc/py23.py", line 6, in <module>
from contextlib import redirect_stderr, redirect_stdout
ImportError: cannot import name redirect_stderr
Upvotes: 1
Views: 1291
Reputation: 3702
The problem was in incorrect version of Python:
https://pypi.org/project/fonttools/
FontTools 4.x requires Python 3.6 or later. FontTools 3.x requires Python 2.7 or later.
I tried to use latest fonttools with Python 2. Installing Python 3 with reinstallation of fonttools solved the issue:
apt-get update
apt-get install -y python3 python-pip
pip install --upgrade pip
hash -r
pip install fonttools
Upvotes: 0
Reputation: 4489
You need to uninstall fontTools
and then install the py27 branch of it. The version you are using isn't backwards compatible to Python 2.7
Upvotes: 1