我刚给我的虚拟人安装了一个枕头包。这样做:
from PIL import Image, ImageFont, ImageDraw
ImageFont.load_path('some_path')我收到一个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/net/isilonP/public/rw/homes/cbl_adm/.virtualenvs/chembl_webservices/lib/python2.7/site-packages/PIL/ImageFont.py", line 264, in load_path
if not isinstance(filename, "utf-8"):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types实际上,如果您检查正式的gihub存储库(https://github.com/python-imaging/Pillow/blob/master/PIL/ImageFont.py#L264),您可以看到这个构造:
if not isinstance(filename, "utf-8"):
...我的问题是:我如何用实际有效的东西来代替它呢?
发布于 2013-07-25 17:23:43
有人忽视了对这种方法的测试;正确的咒语是:
if not isinstance(filename, str):
# ...因为其余的代码将其转换为一个str,用于Python2和Python3。
在与IRC的维护人员交谈后,我发布了一个拉请求。
更新:修补程序现在已经合并。
https://stackoverflow.com/questions/17863735
复制相似问题