python - Function cannot open file after py2exe compile -
i'm using rdkit.
after build using py2exe, when call draw.moltoimage method there error:
warning: unable load font metrics 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')`   there no difference if put these files library.zip (to \rdkit\sping\pil\pilfonts) or dist folder , change paths in pidpil.py valid; application still cannot open metrics.dat. 
without py2exe conversion, works perfectly.
are using 'data_files' in setup.py include pilfonts folder?
e.g. along these lines:
setup(      data_files = [("pilfonts", glob.glob("\rdkit\sping\pil\pilfonts\*.*"),      options = {"py2exe": {"compressed": 2,     # etc etc )      
Comments
Post a Comment