2

I get overflow error using getch in ubuntu. This is the code:

import getch
print("Inserisci 8 caratteri esadecimali: ")
allowedChar = '0123456789abcdefABCDEF'
contatore = 0
uuid = ""
while contatore < 8:
    char = getch.getch()  # User input, but not displayed on the screen
if char in allowedChar:
    print(char, end="", flush=True)
    contatore = contatore + 1
    uuid = uuid + char
uuid = uuid + "-"
print(uuid)

I have to input a UUID but I want to appear only characters allowed (hex digits) but when I type "è" or "ù" or "ò" or "à" I get this error:

Traceback (most recent call last): File "Char.py", line 7, in char = getch.getch() # User input, but not displayed on the screen OverflowError: character argument not in range(0x110000).

Please I need to overcome this error. I need help. I'm not using Windows.

0 Answers0