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

unable to run codespell.py on debian lenny with python 3.2.1 #2

Closed
orbitcowboy opened this issue Nov 6, 2011 · 8 comments
Closed

Comments

@orbitcowboy
Copy link

$ python3 --version
Python 3.2.1

Here is the traceback:

$./codespell.py dictionary.txt dictionary.txt
Traceback (most recent call last):
File "./codespell.py", line 526, in
sys.exit(main(*sys.argv))
File "./codespell.py", line 473, in main
build_dict(args[0])
File "./codespell.py", line 264, in build_dict
for line in f:
File "/usr/local/lib/python3.2/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3170: ordinal not in range(128)

What do you suggest?

Many thanks

Martin

@lucasdemarchi
Copy link
Collaborator

Did you try giving the correct file name? Looking at how you ran it, you should do like below.

$ ./codespell.py data/dictionary.txt data/dictionary.txt

@lucasdemarchi
Copy link
Collaborator

ahnn... and checking the dictionary against the dictionary is just a test, right?

@orbitcowboy
Copy link
Author

Yes, it is just a test. It also happens if i choose another file or directory.

@orbitcowboy
Copy link
Author

Do you have any idea, or hint why it does not working?

@orbitcowboy
Copy link
Author

Ok,

i found i myself:

At line 256 you have to insert the following line:

def build_dict(filename):
with open(filename, 'r', 1, 'utf-8') as f:

On my machine, the encoding was not set by default to utf-8. Can you add this to your next release?

Many thanks for this great tools

Best regards

Ettl Martin

@lucasdemarchi
Copy link
Collaborator

Thanks very much... I applied the fix you suggested. Please, test if it's working now.

@orbitcowboy
Copy link
Author

Thanks for your quick help, it works fine.

Best regards

Martin

2011/12/6 Lucas De Marchi <
reply@reply.github.com

Thanks very much... I applied the fix you suggested. Please, test if it's
working now.


Reply to this email directly or view it on GitHub:
#2 (comment)

@lucasdemarchi
Copy link
Collaborator

Ok, let's make a release with this fix: v1.3 is out

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

2 participants