[affich_tools] debug sur des UnicodeDecodeError
This commit is contained in:
parent
248d199838
commit
b035507bf6
1 changed files with 5 additions and 1 deletions
|
@ -278,7 +278,11 @@ def prompt(prompt, defaut='', couleur='gras'):
|
||||||
if defaut :
|
if defaut :
|
||||||
sys.stdout.write((" [%s]" % defaut).encode(encoding))
|
sys.stdout.write((" [%s]" % defaut).encode(encoding))
|
||||||
sys.stdout.write(" ".encode(encoding))
|
sys.stdout.write(" ".encode(encoding))
|
||||||
v = sys.stdin.readline().decode(encoding).strip()
|
v = sys.stdin.readline()
|
||||||
|
try:
|
||||||
|
v = v.decode(encoding).strip()
|
||||||
|
except UnicodeDecodeError as error:
|
||||||
|
raise UnicodeDecodeError("%s: %r" % (error, v))
|
||||||
if not v: v = defaut
|
if not v: v = defaut
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue