aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pycrctrl/__pycache__/pycrctrl.cpython-36.pycbin0 -> 20344 bytes
-rw-r--r--pycrctrl/pycrctrl.py12
2 files changed, 6 insertions, 6 deletions
diff --git a/pycrctrl/__pycache__/pycrctrl.cpython-36.pyc b/pycrctrl/__pycache__/pycrctrl.cpython-36.pyc
new file mode 100644
index 0000000..23e4767
--- /dev/null
+++ b/pycrctrl/__pycache__/pycrctrl.cpython-36.pyc
Binary files differ
diff --git a/pycrctrl/pycrctrl.py b/pycrctrl/pycrctrl.py
index 09692b9..6c86940 100644
--- a/pycrctrl/pycrctrl.py
+++ b/pycrctrl/pycrctrl.py
@@ -255,7 +255,6 @@ class PyCRCtrl(object):
self.loadConfigFile(config)
self.loadCapabilities()
self.loadScenarioList()
- self.codec = QTextCodec.codecForName(self.config.get("encoding"))
self.queue = queue.Queue(5)
if self.config["Clonk"]["Updater"]["enabled"]:
@@ -377,11 +376,11 @@ class PyCRCtrl(object):
return True
def setupConfig(self, config):
+ #codec
+ self.codec = QTextCodec.codecForName(config["Clonk"]["encoding"])
#commandline
sep = ":" if config["Clonk"]["commandlinePrefix"] == "/" else "="
- config["Clonk"]["commandline"] = " ".join([
- "{}{}".format(config["Clonk"]["commandlinePrefix"], sep.join(entry) if isinstance(entry, list) else entry) for entry in config["Clonk"]["commandline"]
- ])
+ config["Clonk"]["commandline"] = " ".join("{}{}".format(config["Clonk"]["commandlinePrefix"], (sep.join(str(entry)) if isinstance(entry, list) else str(entry))) for entry in config["Clonk"]["commandline"])
#regexps
@@ -390,6 +389,7 @@ class PyCRCtrl(object):
}
self.ingamechat = config["Clonk"]["IRC"]["ingamechat"]
+ return config
def decodeRegExp(self, regexp):
return self.codec.toUnicode(base64.b64decode(regexp))
@@ -540,9 +540,9 @@ class PyCRCtrl(object):
return (CmdResult.RuntimeError, "")
elif type(text) not in [bytes, QByteArray]:
try:
- text = self.codec.toUnicode(text)
+ text = self.codec.fromUnicode(text)
except:
- raise IOError("Cannot write anything else to the server except the following data types: QString, bytes, str, QByteArray")
+ raise IOError("Cannot write anything else to the server except the following data types: QString, bytes, str, QByteArray (got {})".format(type(text).__name__))
if self.clonk and self.clonk.stdin:
self.clonk.stdin.write(bytes(text) + b"\n")