pyTSon
pyTSon copied to clipboard
Hotkeys: UnicodeDecodeError
Hi, I am very new to this API, so I am sorry if I miss something that causes the error :) Now to the Problem, when I try to implement hotkeys into my plugin, I get an unicodeDecodeError in the client protocol. I have build a basic plugin, that replicates the error, at least on my machine.
from ts3plugin import ts3plugin
import ts3lib, ts3defines
class testplugin(ts3plugin):
name = "hotkeytest"
requestAutoload = False
version = "1.0"
apiVersion = 21
author = "Timo"
description = "This is a testplugin"
offersConfigure = True
commandKeyword = ""
infoTitle = ""
menuItems = []#[(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT, 0, "text", "icon.png")]
hotkeys = [("keyword", "description")]#[("keyword", "description")]
def __init__(self):
ts3lib.printMessageToCurrentTab("Yay, we are running!")
ts3lib.requestHotkeyInputDialog("keyword", True)
def stop(self):
ts3lib.printMessageToCurrentTab("Oh no, we were stopped :(")
def onHotkeyRecordedEvent(self, keyword, key):
ts3lib.printMessageToCurrentTab("Recorded")
def onHotkeyEvent(self, keyword):
ts3lib.printMessageToCurrentTab("YEAHHHHH!!!!!")
The error in the client protocol:
01.12.2018 17:35:20 Info Memory usage: 167.97 MiB
01.12.2018 17:35:36 pyTSon Error Calling onHotkeyEvent failed with error "Error calling method
Traceback (most recent call last):
File "C:/Users/Timo/AppData/Roaming/TS3Client/plugins/pyTSon/scripts\pluginhost.py", line 382, in callMethod
return meth(*args)
File "C:/Users/Timo/AppData/Roaming/TS3Client/plugins/pyTSon/scripts\pluginhost.py", line 683, in onHotkeyEvent
cls.showScriptingConsole()
File "C:/Users/Timo/AppData/Roaming/TS3Client/plugins/pyTSon/scripts\pluginhost.py", line 358, in showScriptingConsole
txtcolor, w, h, startup, silent)
File "C:/Users/Timo/AppData/Roaming/TS3Client/plugins/pyTSon/include\pytsonui\console.py", line 89, in __init__
self.runCommand(f.read(), silentStartup)
File "C:/Users/Timo/AppData/Roaming/TS3Client/plugins/pyTSon/lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1587: character maps to <undefined>
"
After starting the plugin and binding a key, I get this error whenever I press the bound button.
Possibly related to #93, #90. Also i suggest using triple backticks (```) even for plain log entries because that eliminates word wrapping.
Thanks for the quick response! I edited my post, it's the first time that I post on GitHub, so thanks for the advice ^^
May I ask two things? :) 1.) Is the overall way I try to set up a hotkey the right one or am I missing something? 2.) Is there a fix in sight or any workaround, so that I can get hotkeys to work? (They are the only feature that's missing before completion of my plugin ^^)
But non the less, thanks for the hard work so far, its so nice and "easy" to work with this API. 🥇
With the help of Bluscream we were able to figure it out.
A wrong path under plugins->pyTSon->setting->scripting console->startup->run script caused the error.
After deleting the path in the config, the console worked again.
But there is still a bug with the ts3lib.requestHotkeyInputDialog, more about this follows.
A wrong path under plugins->pyTSon->setting->scripting console->startup->run script caused the error.
I'm a bit confused, you didn't write anything about the console. Is there anything that needs to be fixed or what trigger the error (and ofc what kind of error)?
I'm a bit confused, you didn't write anything about the console. Is there anything that needs to be fixed or what trigger the error (and ofc what kind of error)?
Well, the fact that pressing hotkeys triggering random stuff (like opening the console) made him think the error was related to his script.