Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo Codes Causes AttributeError When Importing Pilmoji #41

Closed
LucasChenZQ opened this issue Jun 11, 2024 · 1 comment
Closed

Demo Codes Causes AttributeError When Importing Pilmoji #41

LucasChenZQ opened this issue Jun 11, 2024 · 1 comment

Comments

@LucasChenZQ
Copy link

The codes are directly copied from README.md's Usage section, and cause AttributeError in the first code. it seems that the helper module is trying to access a variable from emoji package that doesn't exist

Enviromnents:
macOS - 14.1.1
Python - 3.11.6
pilmoji - 2.0.4
emoji - 2.12.1

The error are as follows:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 from pilmoji import Pilmoji
      2 from PIL import Image, ImageFont
      5 my_string = '''
      6 Hello, world! 👋 Here are some emojis: 🎨 🌊 😎
      7 I also support Discord emoji: <:rooThink:596576798351949847>
      8 '''

File ~/Development/triplenty/server/.venv/lib/python3.11/site-packages/pilmoji/__init__.py:1
----> 1 from . import helpers, source
      2 from .core import Pilmoji
      3 from .helpers import *

File ~/Development/triplenty/server/.venv/lib/python3.11/site-packages/pilmoji/helpers.py:18
     15     from .core import FontT
     17 # This is actually way faster than it seems
---> 18 language_pack: Dict[str, str] = unicode_codes.get_emoji_unicode_dict('en')
     19 _UNICODE_EMOJI_REGEX = '|'.join(map(re.escape, sorted(language_pack.values(), key=len, reverse=True)))
     20 _DISCORD_EMOJI_REGEX = '<a?:[a-zA-Z0-9_]{1,32}:[0-9]{17,22}>'

AttributeError: module 'emoji.unicode_codes' has no attribute 'get_emoji_unicode_dict'"

@jay3332
Copy link
Owner

jay3332 commented Jun 18, 2024

fixed in #40

@jay3332 jay3332 closed this as completed Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants