Added a patched version of jconfig to support non-ascii paths
This commit is contained in:
parent
28d5c2d5d7
commit
9d2615c221
27
src/sessionmanager/jconfig_patched.py
Normal file
27
src/sessionmanager/jconfig_patched.py
Normal 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)
|
@ -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 *
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user