Ian Strawbridge <i...@strawbridge3.plus.com> added the comment:

Further to the information I posted on Stack Overflow (referred to above) 
relating to reproducing emoticon characters from Idle under Ubuntu, I have done 
more testing.  Based on some of the code/comments above, I tried modifications 
which I hoped might identify errors before Idle crashed.
At a simple level I can generate some error information in a Ubuntu terminal 
from the following.
usr/bin$ idle-python3.8
Entering chr(0x1f624) gives the following error message in terminal.
X Error of failed request:  BadLength (poly request too large or internal Xlib 
length error)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  4484
  Current serial number in output stream:  4484

Another test used this code.
--------------
def FileSave(sav_file_name,outputstring):
    with open(sav_file_name, "a", encoding="utf8",newline='') as myfile:
        myfile.write(outputstring)

def FileSave1(sav_file_name,eoutputstring):
    with open(sav_file_name, "a", encoding="utf8",newline='') as myfile:
        myfile.write(eoutputstring)

tk = True
if tk:
    from tkinter import Tk
    from tkinter.scrolledtext import ScrolledText
    root = Tk()
    text = ScrolledText(root, width=80, height=40)
    text.pack()
    def print1(txt):
        text.insert('insert', txt+'\n')

errors = []
outputstring = "Characters:"+ "\n"+"\n"
eoutputstring = "Errors:"+ "\n"+"\n"

#for i in range(0x1f600, 0x1f660):   #crashes at 0x1f624
for i in range(0x1f623, 0x1f624):  # 1f624, 1f625 then try 1f652  
    chars = chr(i)
    decimal = str(int(hex(i)[2:],16))
    try:
        outputstring = str(hex(i))+" "+decimal+" "+chars+ "\n"
        FileSave("Charsfile.txt", outputstring)
        print1(f"{hex(i)} {decimal} {chars}")
        print(f"{hex(i)} {decimal} {chars}")
    except Exception as e:
        print(str(hex(i)))
        eoutputstring = str(hex(i))+ "\n"
        FileSave1("Errorfile.txt", eoutputstring)
        errors.append(f"{hex(i)} {e}")

print("ERRORS:")

for line in errors:
    print(line)

--------------
With the range starting at 0x1f623 and changing the end point, in Ubuntu, with 
end point 0x1f624, this prints ok, but if higher numbers are used the Idle 
windows all closed. However on some occasions, if I began with end point at 
0x1f624 and run, then without closing the editor window I increased the end 
point to 0x1f625, save and run, the Text window would close, but the console 
window would remain open.  I could then increase the upper range further and 
repeat and more characters would print to the console.
I have attached screenshots of the console output with the 
fonts-noto-color-emoji fonts package installed(with font), then with this 
package uninstalled (no font) and finally the same when run under Windows 10.  
For the console output produced while the font package is installed, if I 
select in the character column where there is a blank space, "something" can be 
selected.  If I save the console as a text file or select all the rows, copy 
and paste to a text file, the missing characters are revealed. When the font 
package is uninstalled, the missing characters are truely missing.  It is the 
apparently missing characters (such as 0x1f624, 0x1f62c, 0x1f641, 0x1f642, 
0x1f644-0x1f64f) which appear to be causing the Idle crashes.  Presumably such 
as 0x1f650 and 0x1f651 are unallocated codes so show up as rectangular 
outlines. 

In none of the tests with the more complex code above did I manage to generate 
any error output.

My set up is as follows.
Ubuntu 20.04.1 LTS
x86_64
GNOME version: 3.36.3
Python 3.8.6 (default, Sep 25 2020, 21:22:01) 
Tk version: 8.6.10
[GCC 7.5.0] on linux

Hopefully, the above might give some pointers to handling these characters.

----------
nosy: +IanSt1
versions: +Python 3.8 -Python 3.10
Added file: https://bugs.python.org/file49581/Screenshots_128547-128593.pdf

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42225>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to