rougier/numpy-100

couldn't run initialise.py

cb6e310 opened this issue · 4 comments

there is an error occured when I run initialise.py :

`UnicodeDecodeError Traceback (most recent call last)
D:\cs\mechine learning\numpy-100-master\initialise.py in
1 import numpy as np
2
----> 3 import generators as ge
4
5

D:\cs\mechine learning\numpy-100-master\generators.py in
34
35 HEADERS = ktx_to_dict(os.path.join('source', 'headers.ktx'))
---> 36 QHA = ktx_to_dict(os.path.join('source', 'exercises100.ktx'))
37
38

D:\cs\mechine learning\numpy-100-master\generators.py in ktx_to_dict(input_file, keystarter)
9
10 with open(input_file, 'r+') as f:
---> 11 lines = f.readlines()
12
13 k, val = '', ''

UnicodeDecodeError: 'gbk' codec can't decode byte 0x86 in position 59: illegal multibyte sequence`

When I solved this error by change the 'r+' to 'rb', another error occured. So I'm confused.
Is there a problem with my environment or something else wrong ?
If it helps, my python is 3.7

I'm not sure what is the problem. @SebastianoF (who kindly write the generator) do you have any idea

It seems it is not running from the same folder of import generators as ge. Are you running from the roots of the project?

Right. I'm exactly running the %run initialise.py command in exercise.py which is in the root direction of project.

This error UnicodeDecodeError: 'gbk' codec can't decode byte 0x86 in position 59: illegal multibyte sequence is suspicious. What is the gbk codec and why is it mentioned ?