Closed Anaerin closed 5 years ago
Note: This only happens in Windows. Probably Python being too cautious with it's print() function, as Windows 10's console now supports Unicode (and doesn't need to be converted to CP1252, which is where this seems to be happening)
Do you have any solutions?
Apparently, the answer is "Update to Python 3.6 or higher": https://www.python.org/dev/peps/pep-0528/
Thanks
Using python 3.8 and Pycharm it doesnt work:
Found 950 dupes for section 'Movies'
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\bbaker\AppData\Local\Programs\Python\Python38-32\lib\logging\__init__.py", line 1084, in emit
stream.write(msg + self.terminator)
File "C:\Users\bbaker\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 352-355: character maps to <undefined>
Call stack:
File "C:/Users/bbaker/Desktop/plex_dupefinder-master/plex_dupefinder.py", line 364, in <module>
log.info("ID: %r - Score: %s - Meta:\n%r", part.id, part_info.get('score', 'N/A'),
Message: 'ID: %r - Score: %s - Meta:\n%r'
Arguments: (869094, 64750, {'id': 869094, 'video_bitrate': 0, 'audio_codec': 'Unknown', 'audio_channels': 0, 'video_codec': 'Unknown', 'video_resolution': 'Unknown', 'video_width': 0, 'video_height': 0, 'video_duration': 0, 'file': ['/movies/Armour of God 1986 Bluray-1080p.AAC.x264.龙兄虎弟.mp4'], 'multipart': False, 'file_size': 6475069301, 'score': 64750, 'show_key': '/library/metadata/398766'})
This looks like it fixes the error:
# Setup logger
log_filename = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'activity.log')
logging.basicConfig(
# filename=log_filename,
handlers=[logging.FileHandler(log_filename, 'w', 'utf-8')],
level=logging.DEBUG,
format='[%(asctime)s] %(levelname)s - %(message)s',
datefmt='%H:%M:%S'
)
Getting a lot of these errors:
Some processing does occur, then it crashes with the error:
Any way to fix this?