You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
subprocess.check_output() returns bytes.
The result of the call on line 103 (bytes) is then used to form the command passed to another call of subprocess.check_output() on the following line.
This fails on Python 3.
When lnotify is run on Python 2, the shell command on line 104 is obtained by using % string formatting (a Python 2 default), with a bytes object used as the value of the singular %s. This provides a clean output in Python 2 (say, since it's a PID, 1102) and a mangled one in Python 3 : b'1102', since there is no implicit bytes -> str conversion (apart from bytes' __str__).
window_pid, the bytes instance, must be converted to str (unicode string) in Python 3, before using it as an argument to %.
I'll submit a PR fixing this using from __future__ import unicode_literals.
The text was updated successfully, but these errors were encountered:
The python "lnotify" plugin had some problematic code that would
suppress notifications if the active window was named "tilda",
"xterm", or "gnome-terminal". This list was not user-configurable, and
the code implementing this feature was broken due to weechat#339
(incompatible with common versions of ps) and weechat#334 (python3
bytes-vs-string incompatibility).
This commit removes the problematic code.
Closes: weechat#334Closes: weechat#339
subprocess.check_output()
returnsbytes
.The result of the call on line 103 (bytes) is then used to form the command passed to another call of
subprocess.check_output()
on the following line.This fails on Python 3.
When lnotify is run on Python 2, the shell command on line 104 is obtained by using
%
string formatting (a Python 2 default), with abytes
object used as the value of the singular%s
. This provides a clean output in Python 2 (say, since it's a PID,1102
) and a mangled one in Python 3 :b'1102'
, since there is no implicit bytes -> str conversion (apart from bytes'__str__
).window_pid
, thebytes
instance, must be converted tostr
(unicode string) in Python 3, before using it as an argument to%
.I'll submit a PR fixing this using
from __future__ import unicode_literals
.The text was updated successfully, but these errors were encountered: