mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-12 15:50:01 -08:00
fix: unicode error on windows when writing the config file
This commit is contained in:
@@ -94,8 +94,8 @@ def config(user_config: "Config", path, view, desktop_entry, update):
|
||||
print(f"Successfully wrote \n{f.read()}")
|
||||
exit_app(0)
|
||||
elif update:
|
||||
with open(USER_CONFIG_PATH, "w") as file:
|
||||
file.write(user_config.__repr__())
|
||||
with open(USER_CONFIG_PATH, "w",encoding="utf-8") as file:
|
||||
file.write(user_config.__str__())
|
||||
print("update successfull")
|
||||
else:
|
||||
click.edit(filename=USER_CONFIG_PATH)
|
||||
|
||||
@@ -64,7 +64,7 @@ class Config(object):
|
||||
|
||||
# --- set config values from file or using defaults ---
|
||||
if os.path.exists(USER_CONFIG_PATH):
|
||||
self.configparser.read(USER_CONFIG_PATH)
|
||||
self.configparser.read(USER_CONFIG_PATH,encoding="utf-8")
|
||||
|
||||
self.downloads_dir = self.get_downloads_dir()
|
||||
self.sub_lang = self.get_sub_lang()
|
||||
@@ -103,7 +103,7 @@ class Config(object):
|
||||
|
||||
os.environ["CURRENT_FASTANIME_PROVIDER"] = self.provider
|
||||
if not os.path.exists(USER_CONFIG_PATH):
|
||||
with open(USER_CONFIG_PATH, "w") as config:
|
||||
with open(USER_CONFIG_PATH, "w",encoding="utf-8") as config:
|
||||
config.write(self.__repr__())
|
||||
|
||||
def update_user(self, user):
|
||||
|
||||
Reference in New Issue
Block a user