mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
Don't let the system encoding screw with things,
specify opens as happening with utf-8 encoding
This commit is contained in:
@@ -43,7 +43,7 @@ class Downloader:
|
|||||||
self.LIB_PATH.mkdir(parents=True, exist_ok=True)
|
self.LIB_PATH.mkdir(parents=True, exist_ok=True)
|
||||||
self.SHAREDLIB_PATH.mkdir(parents=True, exist_ok=True)
|
self.SHAREDLIB_PATH.mkdir(parents=True, exist_ok=True)
|
||||||
if not self.SHAREDLIB_INIT.exists():
|
if not self.SHAREDLIB_INIT.exists():
|
||||||
with self.SHAREDLIB_INIT.open(mode='w') as _:
|
with self.SHAREDLIB_INIT.open(mode='w', encoding='utf-8') as _:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if str(self.LIB_PATH) not in syspath:
|
if str(self.LIB_PATH) not in syspath:
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ class Trivia:
|
|||||||
raise FileNotFoundError("Could not find the `{}` category"
|
raise FileNotFoundError("Could not find the `{}` category"
|
||||||
"".format(category))
|
"".format(category))
|
||||||
|
|
||||||
with path.open() as file:
|
with path.open(encoding='utf-8') as file:
|
||||||
try:
|
try:
|
||||||
dict_ = yaml.load(file)
|
dict_ = yaml.load(file)
|
||||||
except yaml.error.YAMLError as exc:
|
except yaml.error.YAMLError as exc:
|
||||||
|
|||||||
@@ -180,9 +180,9 @@ class CogI18n:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
translation_file = locale_path.open('ru')
|
translation_file = locale_path.open('ru', encoding='utf-8')
|
||||||
except ValueError: # We are using Windows
|
except ValueError: # We are using Windows
|
||||||
translation_file = locale_path.open('r')
|
translation_file = locale_path.open('r', encoding='utf-8')
|
||||||
self._parse(translation_file)
|
self._parse(translation_file)
|
||||||
except (IOError, FileNotFoundError): # The translation is unavailable
|
except (IOError, FileNotFoundError): # The translation is unavailable
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user