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

couldn't run initialise.py #100

Open
cb6e310 opened this issue Feb 14, 2020 · 4 comments
Open

couldn't run initialise.py #100

cb6e310 opened this issue Feb 14, 2020 · 4 comments

Comments

@cb6e310
Copy link

cb6e310 commented Feb 14, 2020

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

@rougier
Copy link
Owner

rougier commented Feb 18, 2020

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

@SebastianoF
Copy link
Contributor

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

@cb6e310
Copy link
Author

cb6e310 commented Feb 20, 2020

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

@rougier
Copy link
Owner

rougier commented Feb 20, 2020

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 ?

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

3 participants