pilmoji icon indicating copy to clipboard operation
pilmoji copied to clipboard

Pilmoji not working with any emojis source

Open mateusbatista4 opened this issue 10 months ago • 3 comments

I've encountered an issue where Pilmoji doesn't seem to be working properly with all emoji sources. I've tried using various emoji sources, but the functionality is still not working.

Code Snippet:

response = requests.get(template_path)
img = Image.open(BytesIO(response.content))

width, height = img.size
draw = ImageDraw.Draw(img)
textsize = 34
string = textwrap.wrap(string, width=40)

font = ImageFont.truetype("./resources/upload_image/assets/fonts/Comfortaa-Regular.ttf", textsize)

string_prefix = ["[{}]".format(id), ""]
end_string = string_prefix + string
h = (height - len(end_string)*(textsize+16))/2
for line in end_string:
    a,b = draw.textsize(line, font=font)
    try:
        with Pilmoji(img) as pilmoji:
            pilmoji.text((int((width-a)/2),int(h)), line, (0,0,0), font, align='center', emoji_scale_factor=1, emoji_position_offset=(0, 2))
    except Exception as e:
        # Add error handling
        raise ConnectionError(e, request=request)
    h += textsize + 16
    img.save('./resources/upload_image/assets/img/out/sample-out.jpg')
return True

Error Message: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='emojicdn.elk.sh', port=443): Max retries exceeded with url: /%E2%9D%A4%EF%B8%8F?style=twitter (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001FD97850520>: Failed to establish a new connection: [WinError 10060]

Additional Information: Python Version: 3.8 Operating System: Win11 Pilmoji Version: 2.0.4

mateusbatista4 avatar Apr 18 '24 14:04 mateusbatista4

Someone??

mateusbatista4 avatar May 06 '24 16:05 mateusbatista4

Seems like an issue with emojicdn, maybe a custom source could fix this

jay3332 avatar May 06 '24 16:05 jay3332

What sources? I tried several, like Apple, Microsoft and Discord

mateusbatista4 avatar May 06 '24 16:05 mateusbatista4