Added a patched version of jconfig to support non-ascii paths

This commit is contained in:
Manuel Cortez 2018-12-18 11:48:53 -06:00
parent 28d5c2d5d7
commit 9d2615c221
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
""" Modified Jconfig base class """
import logging
import json
from codecs import open
from jconfig import jconfig
log = logging.getLogger('jconfig_patched')
class Config(jconfig.Config):
log.info("Instantiated patched jconfig instance")
def load(self, filename, **kwargs):
try:
with open(filename, 'r', encoding="utf-8") as f:
settings = json.load(f)
except (IOError, ValueError):
settings = {}
settings.setdefault(self.section_name, {})
return settings
def save(self):
with open(self._filename, 'w', encoding="utf-8") as f:
json.dump(self._settings, f, indent=2, sort_keys=True)

View File

@ -5,7 +5,7 @@ import logging
import vk_api import vk_api
import threading import threading
import requests import requests
import jconfig import jconfig_patched as jconfig
from vk_api.enums import VkUserPermissions from vk_api.enums import VkUserPermissions
from vk_api.exceptions import * from vk_api.exceptions import *