gyli / PyWaffle

🧇 Make Waffle Charts in Python.
MIT License
578 stars 105 forks source link

Font file not found when using FontAwesome icons #4

Closed mostlyoxygen closed 6 years ago

mostlyoxygen commented 6 years ago

When creating a chart with icons a FileNotFoundError is thrown, whilst looking for the file font/FontAwesome.otf. This seems to be because it's trying to find the file relative to the location of the calling script, rather than in the font package created during installation.

A simple fix for this would be to modify waffle.py to import the font package and use its __path__ value to construct the path to the FontAwesome file:

import font
import os
FONTAWESOME_FILE = os.path.join(font.__path__[0], 'FontAwesome.otf')

If you're happy with this fix I can make a pull request.

gyli commented 6 years ago

That's a good one. Fixed.

Thank you!

mostlyoxygen commented 6 years ago

Thanks for fixing it so quickly.