brobsc / easy_tst

easy_tst
GNU Affero General Public License v3.0
2 stars 0 forks source link

Non-ascii characters #10

Closed brobsc closed 6 years ago

brobsc commented 6 years ago
Starting watch mode.
Trying to checkout: "5m8l"
Checking out "5m8l": "Primeiro Número Acima"
Traceback (most recent call last):
  File "/usr/local/bin/easy_tst", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/Users/bruno/easy_tst/bin/easy_tst", line 22, in <module>
    easy_clipboard.watch_mode()
  File "/Users/bruno/easy_tst/easy_tst/easy_clipboard.py", line 44, in watch_mode
    checkout_from_clipboard()
  File "/Users/bruno/easy_tst/easy_tst/easy_clipboard.py", line 23, in checkout_from_clipboard
    tst_wrapper.full_checkout(cv)
  File "/Users/bruno/easy_tst/easy_tst/tst_wrapper.py", line 78, in full_checkout
    full_path = create_exercise_file(name, label, path, code)
  File "/Users/bruno/easy_tst/easy_tst/tst_wrapper.py", line 54, in create_exercise_file
    f.write(header(label, code))
  File "/Users/bruno/easy_tst/easy_tst/tst_wrapper.py", line 138, in header
    'Matrícula: ' + config['mat'],
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)
brobsc commented 6 years ago

@joaopse normal ai? Mudar para Matricula: resolve.

Temos que considerar checar sempre se a string vai ter caracteres nao ascii.

Pode ser uma solucao: https://stackoverflow.com/questions/1342000/how-to-make-the-python-interpreter-correctly-handle-non-ascii-characters-in-stri

Vamos importar esse unicode_literals?

pedroespindula commented 6 years ago
joaopse@lcc2-06:~/github_projects$ easy_tst
Starting watch mode.
Trying to checkout: "590l"
Traceback (most recent call last):
  File "/home/joaopse/.local/bin/easy_tst", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/joaopse/easy_tst/bin/easy_tst", line 22, in <module>
    easy_clipboard.watch_mode()
  File "/home/joaopse/easy_tst/easy_tst/easy_clipboard.py", line 52, in watch_mode
    checkout_from_clipboard()
  File "/home/joaopse/easy_tst/easy_tst/easy_clipboard.py", line 25, in checkout_from_clipboard
    tst_wrapper.full_checkout(cv)
  File "/home/joaopse/easy_tst/easy_tst/tst_wrapper.py", line 94, in full_checkout
    print('Checking out "{}": "{}"'.format(code, label))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal not in range(128)