i have below code in python 3.5 screen of IDE and powershell
real_path_log_file = 'C:\\Users\\XXXXX\\Desktop\\report\\file1.log'
with open(real_path_log_file, 'r', encoding='utf-8') as open_log:
read_log = open_log.readlines()
print(read_log)
from powershell i get below error but if i run this from pycharm i can getting the output of file content please note that file i am reading has ★ character
Traceback (most recent call last):
File ".\test_read_file.py", line 5, in <module>
print(read_log)
File "C:\Users\XXXXX\AppData\Local\Programs\Python\Python35\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2605' in position 367: character maps to <undefined>