mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -05:00
test
This commit is contained in:
parent
987e793bb2
commit
2875ea4a07
@ -5,7 +5,6 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
|||||||
import sopel_modules
|
import sopel_modules
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
from .Logs import logs
|
from .Logs import logs
|
||||||
@ -62,10 +61,9 @@ class BotRead():
|
|||||||
|
|
||||||
# Read dictionary from file, if not, enable an empty dict
|
# Read dictionary from file, if not, enable an empty dict
|
||||||
filereadgood = True
|
filereadgood = True
|
||||||
|
inf = codecs.open(filepath, "r", encoding='utf-8')
|
||||||
|
infread = inf.read()
|
||||||
try:
|
try:
|
||||||
sys.stderr(str(filepath))
|
|
||||||
inf = codecs.open(filepath, "r", encoding='utf-8')
|
|
||||||
infread = inf.read()
|
|
||||||
dict_from_file = eval(infread)
|
dict_from_file = eval(infread)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
filereadgood = False
|
filereadgood = False
|
||||||
@ -114,14 +112,14 @@ class BotRead():
|
|||||||
|
|
||||||
# Read dictionary from file, if not, enable an empty dict
|
# Read dictionary from file, if not, enable an empty dict
|
||||||
filereadgood = True
|
filereadgood = True
|
||||||
|
inf = codecs.open(jsonpath, "r", encoding='utf-8')
|
||||||
|
infread = inf.read()
|
||||||
try:
|
try:
|
||||||
inf = codecs.open(filepath, "r", encoding='utf-8')
|
|
||||||
infread = inf.read()
|
|
||||||
dict_from_file = eval(infread)
|
dict_from_file = eval(infread)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
filereadgood = False
|
filereadgood = False
|
||||||
if logging:
|
if logging:
|
||||||
logs.log("SpiceBot_Modules", "Error loading %s: %s (%s)" % ("Module Commands", e, filepath))
|
logs.log("SpiceBot_Modules", "Error loading %s: %s (%s)" % ("Module Commands", e, jsonpath))
|
||||||
dict_from_file = dict()
|
dict_from_file = dict()
|
||||||
# Close File
|
# Close File
|
||||||
inf.close()
|
inf.close()
|
||||||
@ -134,7 +132,7 @@ class BotRead():
|
|||||||
if not filereadgood or not isinstance(dict_from_file, dict):
|
if not filereadgood or not isinstance(dict_from_file, dict):
|
||||||
dict_from_file = {}
|
dict_from_file = {}
|
||||||
else:
|
else:
|
||||||
dict_from_file["filepath"] = str(filepath)
|
dict_from_file["filepath"] = str(jsonpath)
|
||||||
dict_from_file["filename"] = str(filename_base)
|
dict_from_file["filename"] = str(filename_base)
|
||||||
dict_from_file["folderpath"] = dict_from_file["filepath"].split("/" + dict_from_file["filename"])[0]
|
dict_from_file["folderpath"] = dict_from_file["filepath"].split("/" + dict_from_file["filename"])[0]
|
||||||
dict_from_file["foldername"] = str(dict_from_file["folderpath"]).split("/")[-1]
|
dict_from_file["foldername"] = str(dict_from_file["folderpath"]).split("/")[-1]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user