butterscotchstallion / limnoria-plugins

A smattering of Limnoria plugins I've written
MIT License
14 stars 14 forks source link

Made it work properly (at all) on py3 again. #102

Closed rostob closed 7 years ago

rostob commented 7 years ago

It should also still work on py2.

butterscotchstallion commented 7 years ago

Also, @rostob please try the latest master code. I have accepted several PRs addressing Python 2/3 compatibility

lunchdump commented 7 years ago

The latest version works for me on both Python 2 and Python 3

rostob commented 7 years ago

@lunchdump The latest master does not work on Python 3. It loads, but it does not work. It does not give any hints as to why it does not work either, that is why I needed to fix it. If my pull request gets accepted, I would appreciate feedback on if it still functions properly with Python 2.

lunchdump commented 7 years ago

I have 2 bots running both py2 and py3, both are using this plugin without local changes, both work fine.

Could you provide more information about your environment, or steps to reproduce? Are you sure you have all the dependencies in requirements.txt installed? Have you enabled debug logging? (!config supybot.log.level DEBUG)

rostob commented 7 years ago

In the current master, only the default handler works on Python3. If you have the default handler disabled, no titles are handled, which is my environment. To reproduce, disable the default handler and try any URL with a handler, or just look at the code: grep -B1 'utf-8' plugin.py

These .decode("utf-8") makes it not work, silently, on Python3.

On Python2, in the current master, the default handler can probably not handle unicode in its template. To test, add some unicode to the default template string, when running with Python2.

My commits fixes all these issues. I also noticed that the "t" command is broken. I have now also fixed that.