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

charmap error! #30

Open
tombets2424 opened this issue Mar 12, 2018 · 22 comments
Open

charmap error! #30

tombets2424 opened this issue Mar 12, 2018 · 22 comments

Comments

@tombets2424
Copy link

any help resolving this appreciated...

python answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 276, in
load_json()
File "answer_bot.py", line 63, in load_json
sample_questions = json.loads(open("Data/questions.json").read())
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 94: character maps to

@enegronjr
Copy link

So I'm not sure which of these work, or if they worked together.

  1. In the answer_bot.py, I added a line at the very beginning "file = open("answer_bot.py", encoding="Latin-1")". I read somewhere that the language that it was encoding in could be wrong and to set it at the beginning of the program.
  2. I opened cp1252.py and commented out the line containing 0x9d, since it was undefined.
    If you have any questions, feel free to keep them coming!

@enegronjr
Copy link

Any luck?

@tombets2424
Copy link
Author

hello, yes! the second one worked (to get rid of that line). sorry it took me awhile, we're from different time zones.

@tombets2424
Copy link
Author

got a different error after fixing that one?
image

thanks for help.

@enegronjr
Copy link

I had the same issue, I believe I just added "shell=True" into the parentheses on line 111 of pytesseract.py

@tombets2424
Copy link
Author

okay, did that (I believe correctly as I got a new error). The code is just below the grey bar.
image

This is the actual error...
image

Hopefully you got that error to and fixed it? xD

@enegronjr
Copy link

enegronjr commented Mar 13, 2018

I had to edit my environmental variables. edit the variable path, then add "C:\Program Files (86x)\Tesseract-OCR\tesseract.exe"

I've been getting tons of errors so glad to hear I'm not alone

@tombets2424
Copy link
Author

tombets2424 commented Mar 13, 2018

yeah I have no idea where to put that exactly :? oh lol, I have no idea what I'm doing just trying my best!

@enegronjr
Copy link

type in your search bar "evnironmental varibles" and select the first thing that pops up. Then select Environment Variables on the bottom of the window. In the bottom half of the next window, find the varible path in the left column. Select it then click edit. In the next window click add then copy and paste
"C:\Program Files (86x)\Tesseract-OCR\tesseract.exe" into the new text box.

I would attach pictures but I am currently using a school computer and I don't have access to it.

@tombets2424
Copy link
Author

I somehow don't have 'environmental variables' folders or files anywhere. only three environment python files. I must have done something wrong somewhere else, unless I'm just stupid!!

@enegronjr
Copy link

It's not a folder, its a setting on the computer

@tombets2424
Copy link
Author

ahhh I am stupid. I don't have tesseract installed in that location? like tesseract isn't even located in Program Files (86x) at all. Do I need it installed there?

@enegronjr
Copy link

No just find where it's located and paste that

@tombets2424
Copy link
Author

ahhhh... I'm giving up for today but, thanks! I feel like I'm getting closer but then another error occurs. Have you used this yet or do you have errors?

@enegronjr
Copy link

enegronjr commented Mar 13, 2018 via email

@0bytedna
Copy link

@sushant10 bro, can you help fixing this error?

@enegronjr
Copy link

@0bytedna if you give me more info on your case I'll help

@0bytedna
Copy link

All good now, commented out the line containing 0x9d, and added shell=True in line 111. But, the script runs very slowly.

@Jimmychou2
Copy link

how do i fix this?

image

@0bytedna
Copy link

Probably tesseract or PIL package issue

@Iansa9
Copy link

Iansa9 commented Apr 2, 2018

Now I am having this error.

image

@nanip9997
Copy link

@IanNS333 did you add the tessdata to your environment variables hope it works you need to add it to make the tesseract fully functional

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

6 participants