Closed 7MinSec closed 6 years ago
Is this a python3 compatibility thing?
Indeed. Fixed.
Hey thanks again for quick fix. I pulled the plugin down and ran it today and the console says:
Exception in thread Thread-103: Traceback (most recent call last): File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner self.run() File "/usr/lib/python3.4/threading.py", line 868, in run self._target(_self._args, *_self._kwargs) File "/home/brian/bot/plugins/TWSS/plugin.py", line 58, in _import_twss from . import twss File "/home/brian/bot/plugins/TWSS/twss.py", line 51 print last ^
SyntaxError: Missing parentheses in call to 'print'
Fixed.
Hi there! I grabbed the new version and activated it, and now when I say a TWSS trigger in the channel, I no longer get errors. But the bot also doesn't chime in with "that's what she said." Best I can tell the plugin is either "enabled" or not. Am I missing the obvious?
Any error in the console? Is supybot.plugins.TWSS.enable set to true on the channel?
Well I did this in my channel: !config supybot.plugins.twss.enable true. Is there anymore to it? And nope, the console looks clean this time.
what is the reply to !config channel #channelname supybot.plugins.twss.enable
?
The bot says "True" on both channels I've tried to enable it for.
In TWSS/plugin.py, replace:
def doPrivmsg(self, irc, msg):
if self.registryValue('enable', msg.args[0]) and self._twss:
jenni = Jenny()
self._twss.say_it(jenni, msg.args[1])
if jenni._msg:
irc.reply(jenni._msg)
with:
def doPrivmsg(self, irc, msg):
print('--- a')
print(self.registryValue('enable', msg.args[0]))
print(bool(self._twss))
if self.registryValue('enable', msg.args[0]) and self._twss:
print('---- b')
jenni = Jenny()
self._twss.say_it(jenni, msg.args[1])
print('---- c')
if jenni._msg:
print('---- d')
irc.reply(jenni._msg)
print('---- e')
Then reload the plugin. What does it show in the console this time?
Code changed and code reloaded - I don't seem to see any change in console output.
That means the code is not actually run. Make sure you don't have an other instance of TWSS instealled somewhere else (check the directories listed in supybot.directories.plugins
), that you remove .pyc files, etc.
Sorry I should've been more clear - in the console I see "unload called in private by..." and "load called in private by ..." in the console when I unload/reload TWSS, but should I be seeing something else?
I understood that, but could you check the things I mentioned in my previous post?
Sure. My .conf file says my supybot.directories.plugins
is /home/brian/bot/plugins.
Inside that directory I have Trivia
and TWSS
That's the only place I have tried to put TWSS in the past, but I did a locate
for twss.py
just in case and it wasn't anywhere else on the machine.
When you say "remove .pyc" files could you provide more specifics? I'm not sure which ones to look for and delete.
Nevermind. could you load the Debug plugin, and tell me the output of @eval __import__(irc.getCallback('GitHub').__module__)
?
Is this what you're looking for? The command didn't run with @ in front of it but when running without:
Oops, sorry, wrong command. @eval __import__(irc.getCallback('TWSS').__module__)
If I chat that to the bot with @
I get @eval is not a valid command
. If I run without @
I get:
<module 'TWSS' from '/home/brian/bot/plugins/TWSS/__init__.py'>
What is the output of grep print /home/brian/bot/plugins/TWSS/plugin.py
? (run it in a shell)
Sure:
print('--- a') print(self.registryValue('enable', msg.args[0])) print(bool(self._twss)) print('---- b') print('---- c') print('---- d') print('---- e')
What if you restart the bot?
This weekend I shut it down, did a git pull
and fired it back up again. I also just shut 'er down and restarted a few moments ago, but still no "TWSS" getting triggered when we say things inside of twss.txt.
Try rm -f /home/brian/bot/plugins/TWSS/*.pyc
and rf -rf /home/brian/bot/plugins/TWSS/__pycache__/
and restart the bot
Did all those things and bot still remains silent. Question though - does it treat the bot OWNER any differently or should it respond to me too? So far I've just made the bot join an alt channel from my primary and tried to say things in the channel to generate a TWSS response. One thing I can try this weekend is just joining as a regular user from a Web client and see if I can get a TWSS response.
does it treat the bot OWNER any differently
Not in that case.
Does the bot answer to you when you use other commands?
Yep, it'll respond fine to !learn
!factoid
etc. no problem.
Could you give me the output of @eval __import__(irc.getCallback('TWSS').plugin.__module__)
(on IRC) and the content of /home/brian/bot/plugins/TWSS/plugin.py
?
Pardon the delay, I must've missed this email!
Output of @eval __import__(irc.getCallback('TWSS').plugin.__module__)
on IRC is:
braimee: An error has occurred and has been logged. Check the logs for more information.
And the output of plugin.py is:
###
# Copyright (c) 2012, Valentin Lorentz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the author of this software nor the name of
# contributors to this software may be used to endorse or promote products
# derived from this software without specific prior written consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###
import threading
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('TWSS')
class Jenny:
_msg = None
def say(self, msg):
self._msg = msg
@internationalizeDocstring
class TWSS(callbacks.Plugin):
"""Add the help for "@plugin help TWSS" here
This should describe *how* to use this plugin."""
def __init__(self, irc):
super(TWSS, self).__init__(irc)
self._twss = None
threading.Thread(target=self._import_twss).start()
def _import_twss(self):
from . import twss
self._twss = twss
def doPrivmsg(self, irc, msg):
print('--- a')
print(self.registryValue('enable', msg.args[0]))
print(bool(self._twss))
if self.registryValue('enable', msg.args[0]) and self._twss:
print('---- b')
jenni = Jenny()
self._twss.say_it(jenni, msg.args[1])
print('---- c')
if jenni._msg:
print('---- d')
irc.reply(jenni._msg)
print('---- e')
Class = TWSS
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
Ok, I found the problem. This line:
def doPrivmsg(self, irc, msg):
should have one indentation level, to be in the class. Like this:
def doPrivmsg(self, irc, msg):
I moved to a brand new VPS, installed Limnoria and TWSS from scratch, verified the def doPrivmsg(self, irc, msg):
was indented right, and I'm still not getting the bot to say "TWSS" when triggers are said. Sorry for the trouble but dang, I really want this to work. Can I re-run some debugging/troubleshooting commands to show you what's up?
Could you show me the full content of plugin.py
and the reply to !config channel #channelname supybot.plugins.twss.enable
?
Pardon the delay. Here's plugin.py:
###
# Copyright (c) 2012, Valentin Lorentz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the author of this software nor the name of
# contributors to this software may be used to endorse or promote products
# derived from this software without specific prior written consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###
import threading
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('TWSS')
class Jenny:
_msg = None
def say(self, msg):
self._msg = msg
@internationalizeDocstring
class TWSS(callbacks.Plugin):
"""Add the help for "@plugin help TWSS" here
This should describe *how* to use this plugin."""
def __init__(self, irc):
super(TWSS, self).__init__(irc)
self._twss = None
threading.Thread(target=self._import_twss).start()
def _import_twss(self):
from . import twss
self._twss = twss
def doPrivmsg(self, irc, msg):
if self.registryValue('enable', msg.args[0]) and self._twss:
jenni = Jenny()
self._twss.say_it(jenni, msg.args[1])
if jenni._msg:
irc.reply(jenni._msg)
Class = TWSS
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
And here's the output for !config channel #mychannel supybot.plugins.twss.enable
[Bot] True
Hey there,
The TWSS plugin looks like a riot. When I tell the bot to "load twss" I get "The operation succeeded" however the "twss" doesn't fire when a match from twss.txt is said. In the logs I see:
Is this a python3 compatibility thing?
Brian