我正在使用rdkit。
使用构建后py2exe
,当我调用该Draw.MolToImage
方法时出现错误:
Warning: unable to load font metrics from dir
C:\pythonApp\dist\library.zip\rd
kit\sping\PIL\pilfonts
Traceback (most recent call last):
File "app.py", line 470, in <module>
img=Draw.MolToImage(part[i])
File "rdkit\Chem\Draw\__init__.pyc", line 124, in MolToImage
File "rdkit\Chem\Draw\MolDrawing.pyc", line 536, in AddMol
File "rdkit\Chem\Draw\MolDrawing.pyc", line 351, in _drawLabel
File "rdkit\Chem\Draw\spingCanvas.pyc", line 74, in addCanvasText
File "rdkit\sping\PIL\pidPIL.pyc", line 333, in drawString
ValueError: bad font: Font(12,0,0,0,'helvetica')`
如果我将这些文件放入library.zip
(to \rdkit\sping\PIL\pilfonts
) 或只是放入dist
文件夹并将路径更改pidPIL.py
为有效,则没有区别;应用程序仍然无法打开metrics.dat
。
没有py2exe
转换,一切都完美无缺。