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

[BUG] TypeError: expected string or bytes-like object when entering e.g. "ä, ü, ö" #70

Open
Mangosniper opened this issue Sep 7, 2020 · 0 comments

Comments

@Mangosniper
Copy link

Mangosniper commented Sep 7, 2020

I have issues when entering some characters e.g. into in Input. These characters are not only german umlaute like "ä, ü, ö" but also shift, arrow-up and some more. The error is:

Input two letters: Traceback (most recent call last):
  File "test.py", line 9, in <module>
    prompt()
  File "test.py", line 6, in prompt
    var_two_letters = two_letters.launch()
  File "/home/administrator/.local/lib/python3.6/site-packages/bullet/client.py", line 444, in launch
    if self.valid(result):
  File "/home/administrator/.local/lib/python3.6/site-packages/bullet/client.py", line 417, in valid
    if not bool(re.match(self.pattern, ans)):
  File "/usr/lib/python3.6/re.py", line 172, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object

Minimal code to reproduce ist:

from bullet import Input

two_letters = Input(prompt = "Input two letters: ", pattern="^[A-Z]{2}$")

def prompt():
    var_two_letters = two_letters.launch()
    print(var_two_letters)

prompt()

Actually, I dont even want to enter such characters, as you can see that the regex in the pattern only accepts plain characters. However, the script crashes when I just type in the character, so there is no way for me to sanitize the input before the crash.

Is there anything I can do about this? I tried the native "input" function of pything and here I can add Umlaute.

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

1 participant