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

yaml.reader.ReaderError: unacceptable character, special characters are not allowed #207

Closed
ZilbergSP opened this issue Jun 9, 2021 · 14 comments
Labels
bug Something isn't working

Comments

@ZilbergSP
Copy link

After tgcf live i got:

    raise ReaderError(self.name, position, ord(character),
yaml.reader.ReaderError: unacceptable character #x0082: special characters are not allowed
  in "tgcf.config.yml", position 225

tgcf.config.yml:

plugins:
  filter:
    text:
      blacklist: ["тест"]

problem in the word "тест", in previous versions everything is ok

@ZilbergSP ZilbergSP added the bug Something isn't working label Jun 9, 2021
@aahnik aahnik changed the title special characters YAML yaml.reader.ReaderError: unacceptable character, special characters are not allowed Jun 9, 2021
@aahnik
Copy link
Owner

aahnik commented Jun 9, 2021

Which OS and which version of python are you using @cat157 ? This issue may be related with #205

I could not reproduce this problem in Linux.

@ZilbergSP
Copy link
Author

Interesting ... I changed the server to digital ocean and everything works. I am sorry to bother you.
OS was Ubuntu 20.04 lts, ​​digital ocean is the same.

@aahnik aahnik reopened this Jun 9, 2021
@aahnik
Copy link
Owner

aahnik commented Jun 9, 2021

I know this will work on Linux. But initially did in fail on Windows ? This is an important issue for windows users.

What was the os, in which the error occurred. I need to find the reason.

@tissole
Copy link

tissole commented Jun 9, 2021

I can confirm this issue on Windows 10 running tgcf 0.2.5.post0. Here is the log:

Traceback (most recent call last):
File "D:\TeleGram\tgcf.venv\Scripts\tgcf", line 5, in
app()
File "D:\TeleGram\tgcf.venv\lib\site-packages\typer\main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "D:\TeleGram\tgcf.venv\lib\site-packages\click\core.py", line 829, in call
return self.main(*args, **kwargs)
File "D:\TeleGram\tgcf.venv\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "D:\TeleGram\tgcf.venv\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:\TeleGram\tgcf.venv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "D:\TeleGram\tgcf.venv\lib\site-packages\typer\main.py", line 497, in wrapper
return callback(**use_params) # type: ignore
File "D:\TeleGram\tgcf\tgcf\cli.py", line 89, in main
from tgcf.past import forward_job # pylint: disable=import-outside-toplevel
File "D:\TeleGram\tgcf\tgcf\past.py", line 16, in
from tgcf import config
File "D:\TeleGram\tgcf\tgcf\config.py", line 149, in
CONFIG = read_config()
File "D:\TeleGram\tgcf\tgcf\config.py", line 96, in read_config
config_dict = yaml.full_load(file)
File "D:\TeleGram\tgcf.venv\lib\site-packages\yaml_init_.py", line 142, in full_load
return load(stream, FullLoader)
File "D:\TeleGram\tgcf.venv\lib\site-packages\yaml_init_.py", line 112, in load
loader = Loader(stream)
File "D:\TeleGram\tgcf.venv\lib\site-packages\yaml\loader.py", line 24, in init
Reader.init(self, stream)
File "D:\TeleGram\tgcf.venv\lib\site-packages\yaml\reader.py", line 85, in init
self.determine_encoding()
File "D:\TeleGram\tgcf.venv\lib\site-packages\yaml\reader.py", line 124, in determine_encoding
self.update_raw()
File "D:\TeleGram\tgcf.venv\lib\site-packages\yaml\reader.py", line 178, in update_raw
data = self.stream.read(size)
File "C:\Users\kms\AppData\Local\Programs\Python\Python39\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 0x81 in position 255: character maps to

@ZilbergSP
Copy link
Author

ZilbergSP commented Jun 9, 2021

I know this will work on Linux. But initially did in fail on Windows ? This is an important issue for windows users.

What was the os, in which the error occurred. I need to find the reason.

The previous one was also Ubuntu. Current - Ubuntu, only now on digital ocean. This surprised me.
I will try to run on Windows for the test today.

@aahnik
Copy link
Owner

aahnik commented Jun 9, 2021

The previous one was also Ubuntu 20.04

My computer also has ubuntu. But I did not face any issue. May be some dependency related to yaml was missing in your computer.

@aahnik
Copy link
Owner

aahnik commented Jun 9, 2021

I can confirm this issue on Windows 10 running tgcf 0.2.5.post0. Here is the log:

Hi @tissole where is the remaining log. The last line seems incomplete.

@tissole
Copy link

tissole commented Jun 9, 2021

Sorry! This is the last line

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 255: character maps to <undefined>

@aahnik
Copy link
Owner

aahnik commented Jun 11, 2021

hi @tissole , try again with the latest version of tgcf. and show me your configuration file and full logs. Use pastebin https://del.dog/ for sharing large texts.

run tgcf --loud live, use emojis, and other weird characters in the yaml file.

@tissole
Copy link

tissole commented Jun 12, 2021

My config https://del.dog/erimilytuc.txt
Log after running tgcf --loud live https://del.dog/gixexaroca.txt
I deleted line 19 from config and the error was the same https://del.dog/lugestehob.txt
Then I replaced line 18 (Russian characters with the former line 19 (Japanese characters).
Log https://del.dog/orevollina.txt Only line 198 was changed.

Finally, I deleted line 18, and I kept only the first 17 lines in config. There was no error and I could forward messages to the source channel. The messages in source https://i.imgur.com/vgHwGYF.png
In the destination https://i.imgur.com/314Gf71.png
Log https://del.dog/ygrefighin.txt

@aahnik
Copy link
Owner

aahnik commented Jun 12, 2021

thanks a lot, @tissole for the logs. The new logs are much easier to read.

@aahnik
Copy link
Owner

aahnik commented Jun 13, 2021

hi @tissole, install the latest unreleased tgcf from source and try with the same config.

@tissole
Copy link

tissole commented Jun 13, 2021

My config https://del.dog/rughackegy.txt
Log https://del.dog/vacyllanar.txt
Messages in source https://i.imgur.com/IyZEEsT.png
Messages in destination https://i.imgur.com/Zf9LDwI.png
I think you solved this issue.

By the way, the shell is more colorful now, even the errors look nice :)

@aahnik
Copy link
Owner

aahnik commented Jun 13, 2021

hi @cat157 this error is now solved. From v0.2.8 onwards

click here Update to the latest version

@aahnik aahnik closed this as completed Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants