grep.py: tries to concatenate bytes in strings in python3
Mic92 opened this issue · 3 comments
Script / WeeChat
- Name of script: grep.py
- Script version: 0.8.2
- WeeChat version: 2.7.1
This bug has been reported to the script author? Yes/No Yes
cc @m4v
Response or reason:
Not yet responded just mentioned in this issue
Bug summary
07:10 python: registered script "grep", version 0.8.2 (Search in buffers and logs)
07:10 python: stdout/stderr (grep): Traceback (most recent call last):
07:10 python: stdout/stderr (grep): File "/home/joerg/.weechat/python/grep.py", line 1019, in grep_process_cb
07:10 python: stdout/stderr (grep): grep_stdout += out
07:10 python: stdout/stderr (grep): TypeError: can only concatenate str (not "bytes") to str
Steps to reproduce
1. /script install grep.py
2. /grep foo
Current behavior
raises an exception
Expected behavior
returns a result
Suggested solutions
It either uses byte strings or strings consistently
Additional information
This is happening because of changes made in WeeChat 2.7 to fix bugs in Python plugin with strings containing invalid UTF-8 data and sent to callbacks.
For more info see the release notes and the new section in the scripting guide:
- Release notes: https://weechat.org/files/releasenotes/ReleaseNotes-devel.html#v2.7_python3_callbacks_strings
- Scripting guide: https://weechat.org/files/doc/devel/weechat_scripting.en.html#_strings_received_in_callbacks
So the script must be fixed accordingly.
Note that there's already a work in progress to make this script compatible with Python 3: #372.
See also the WeeChat issue for more information about the problem fixed in 2.7: weechat/weechat#1389
Thanks @martinetd