-
Notifications
You must be signed in to change notification settings - Fork 45
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
Custom mappings are read with the wrong encoding on Windows #100
Comments
Hmm could be encoding, but for easy test would be download this https://github.com/RickDB/PlexAniSync-Custom-Mappings/blob/main/series-tvdb.en.yaml and use it as the custom mapping for now. If it run successfully then try editing it and put the values you have. |
Tried this, but the same thing happens. Opens then closes immediately. Log file shows nothing other than the version and that the custom mapping was found/loaded. The most information seems to come from the Pycache Custom mapping file: `a
d�¡�Z�d�Ze�G d�d�„ d�ƒ�ƒ�Z Seems almost corrupted, but that's no surprise. On line 20 it says "Not Validated" and shows it's being checked against the shema. I don't know why it would be different, and when comparing it between everything, I don't see where the problem would be. I'll include it here just to be sure: entries: list(include('entry'), min=1)
---
entry:
title: str()
synonyms: list(str(), required=False)
seasons: list(include('season'), min=1)
season:
season: int(min=1)
anilist-id: int(min=1)
start: int(required=False) EDIT: As soon as I clicked "update" to post the comment I think I may have solved it. The Shema looking for entries: list(include('entry'), min=1)
---
entry: But even the example file starts like this: entries:
- title: The Rising of the Shield Hero
seasons: |
Hmm, that's weird 🤔 okay just to make sure this only happens when you are using the custom_mappings? Have you tried it without custom mapping and it works? |
That would be correct. Notepad++ shows all related files being encoded in UTF-8. If I rename |
Update: C:\Python39\Scripts\PlexAniSync-1.3.16>python PlexAniSync.py
2022-01-19 00:37:33 PlexAniSync - version: 1.3.16
2022-01-19 00:37:33 [MAPPING] Custom map file found: custom_mappings.yaml
Traceback (most recent call last):
File "C:\Python39\Scripts\PlexAniSync-1.3.16\PlexAniSync.py", line 131, in <module>
start()
File "C:\Python39\Scripts\PlexAniSync-1.3.16\PlexAniSync.py", line 84, in start
anilist.CUSTOM_MAPPINGS = read_custom_mappings()
File "C:\Python39\Scripts\PlexAniSync-1.3.16\custom_mappings.py", line 29, in read_custom_mappings
schema = yamale.make_schema('./custom_mappings_schema.yaml', parser='ruamel')
File "C:\Python39\lib\site-packages\yamale\yamale.py", line 10, in make_schema
raw_schemas = readers.parse_yaml(path, parser, content=content)
File "C:\Python39\lib\site-packages\yamale\readers\yaml_reader.py", line 35, in parse_yaml
return parse(f)
File "C:\Python39\lib\site-packages\yamale\readers\yaml_reader.py", line 17, in _ruamel
return list(yaml.load_all(f))
File "C:\Python39\lib\site-packages\ruamel\yaml\main.py", line 460, in load_all
while constructor.check_data():
File "C:\Python39\lib\site-packages\ruamel\yaml\constructor.py", line 108, in check_data
return self.composer.check_node()
File "_ruamel_yaml.pyx", line 687, in _ruamel_yaml.CParser.check_node
File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event
ruamel.yaml.parser.ParserError: did not find expected <document start>
in "./custom_mappings_schema.yaml", line 7, column 1 Line 7 col 1 in The resulting error: C:\Python39\Scripts\PlexAniSync-1.3.16>python PlexAniSync.py
2022-01-19 00:49:36 PlexAniSync - version: 1.3.16
2022-01-19 00:49:36 [MAPPING] Custom map file found: custom_mappings.yaml
Traceback (most recent call last):
File "C:\Python39\Scripts\PlexAniSync-1.3.16\PlexAniSync.py", line 131, in <module>
start()
File "C:\Python39\Scripts\PlexAniSync-1.3.16\PlexAniSync.py", line 84, in start
anilist.CUSTOM_MAPPINGS = read_custom_mappings()
File "C:\Python39\Scripts\PlexAniSync-1.3.16\custom_mappings.py", line 32, in read_custom_mappings
file_mappings = yamale.make_data(MAPPING_FILE, parser='ruamel')
File "C:\Python39\lib\site-packages\yamale\yamale.py", line 29, in make_data
raw_data = readers.parse_yaml(path, parser, content=content)
File "C:\Python39\lib\site-packages\yamale\readers\yaml_reader.py", line 35, in parse_yaml
return parse(f)
File "C:\Python39\lib\site-packages\yamale\readers\yaml_reader.py", line 17, in _ruamel
return list(yaml.load_all(f))
File "C:\Python39\lib\site-packages\ruamel\yaml\main.py", line 460, in load_all
while constructor.check_data():
File "C:\Python39\lib\site-packages\ruamel\yaml\constructor.py", line 108, in check_data
return self.composer.check_node()
File "_ruamel_yaml.pyx", line 687, in _ruamel_yaml.CParser.check_node
File "_ruamel_yaml.pyx", line 902, in _ruamel_yaml.CParser._parse_next_event
File "_ruamel_yaml.pyx", line 911, in _ruamel_yaml.input_handler
File "C:\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 0x8d in position 1273: character maps to <undefined> I replaced the empty line, but no closer to figuring out why custom mapping isn't working. |
You're looking in the wrong spot. Default encoding seems to be Windows 1252 instead of UTF-8, that's the latest error. There's currently no way to set the encoding manually in Yamale. Have to file a feature request later. Also, the |
I think removing the line with Chūnibyō in it will help with the encoding issue. And like I said, delete the Also, please revert the schema file to how it was before. |
Did everything you said and ran it again: 2022-01-19 01:20:05 PlexAniSync - version: 1.3.16
2022-01-19 01:20:05 [MAPPING] Custom map file found: custom_mappings.yaml
2022-01-19 01:20:05 Custom Mappings validation failed!
2022-01-19 01:20:05 entry: Unexpected element
2022-01-19 01:20:05 entries: 'None' is not a list. Removed Weird because 'Chūnibyō' was taken from here: https://github.com/RickDB/PlexAniSync-Custom-Mappings/blob/7b9d7098ad0914bfaa76d93946f95dc98ab8240e/series-tvdb.en.yaml#L386 Well everything works now. Thanks for all the help! |
Reopening to keep track of this issue in this repository. I've reported the bug in the Yamale repo: 23andMe/Yamale#189 |
Fixed with v1.3.18. |
Tried to deal with the list of shows it spit out in the Failed list. After creating the custom mappings list, Plexanisync starts and then closes immediately. The only thing that is spit out in either logs (the normal or debug one) is this:
Not very helpful. Have no idea what the problem is.
Ran my custom mappings through a quick online YAML validator. Found a copy/paste error where one of the sections was missing a Seasons section. Fixed that, but still doesn't work.
The only information I can find is in the pycache and having a look at the custom_mappings.cpython-39.pyc file in notpad++. The jumbled mess seems to say that the custom mapping file isn't valid. Doesn't say why though. Passing it through the online YAML validator says it's valid, so at least I know it's structured correctly now.
This is my custom_mappings.yaml file (updated):
The text was updated successfully, but these errors were encountered: