jay3332 / pilmoji

Pilmoji is a fast and reliable emoji renderer for PIL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

broken

Lumabots opened this issue · comments

Traceback (most recent call last):
File "/Users/luma/Code/V2/test.py", line 1, in
from pilmoji import Pilmoji
File "/Users/luma/Code/V2/.venv/lib/python3.11/site-packages/pilmoji/init.py", line 1, in
from . import helpers, source
File "/Users/luma/Code/V2/.venv/lib/python3.11/site-packages/pilmoji/helpers.py", line 18, in
language_pack: Dict[str, str] = unicode_codes.get_emoji_unicode_dict('en')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'emoji.unicode_codes' has no attribute 'get_emoji_unicode_dict'

@jay3332 please fix it fast

just downgrad emoji, i can fix his code with a fork but it will not be publish before a long time. Its better if u just download emoji, (pilmoji use emoji)
pip install emoji==2.11.0 should work

i made up a fix on my github, feel free to use that fork because idk when jay will merge my fix

commented

quick fix

fork the repo and update the requirements.txt:

Pillow
emoji==2.11.0

longer fix

he removed get_emoji_unicode_dict() and placed it under utils/testutils.py - here. likely just port over code below into helpers.py here.

import emoji.unicode_codes

# ... omitted

_EMOJI_UNICODE: Dict[str, Any] = {lang: None for lang in emoji.LANGUAGES}  # Cache for the language dicts
_ALIASES_UNICODE: Dict[str, str] = {}  # Cache for the aliases dict

def get_emoji_unicode_dict(lang: str) -> Dict[str, Any]:
    """Generate dict containing all fully-qualified and component emoji name for a language
    The dict is only generated once per language and then cached in _EMOJI_UNICODE[lang]"""

    if _EMOJI_UNICODE[lang] is None:
        _EMOJI_UNICODE[lang] = {data[lang]: emj for emj, data in emoji.EMOJI_DATA.items()
                                if lang in data and data['status'] <= emoji.STATUS['fully_qualified']}

    return _EMOJI_UNICODE[lang]

quick fix

fork the repo and update the requirements.txt:

Pillow
emoji==2.11.0

longer fix

he removed get_emoji_unicode_dict() and placed it under utils/testutils.py - here. likely just port over code below into helpers.py here.

import emoji.unicode_codes

# ... omitted

_EMOJI_UNICODE: Dict[str, Any] = {lang: None for lang in emoji.LANGUAGES}  # Cache for the language dicts
_ALIASES_UNICODE: Dict[str, str] = {}  # Cache for the aliases dict

def get_emoji_unicode_dict(lang: str) -> Dict[str, Any]:
    """Generate dict containing all fully-qualified and component emoji name for a language
    The dict is only generated once per language and then cached in _EMOJI_UNICODE[lang]"""

    if _EMOJI_UNICODE[lang] is None:
        _EMOJI_UNICODE[lang] = {data[lang]: emj for emj, data in emoji.EMOJI_DATA.items()
                                if lang in data and data['status'] <= emoji.STATUS['fully_qualified']}

    return _EMOJI_UNICODE[lang]

i already made up a fix and made a pu ll request but im not sure he will push it before a long time

fixed in #40