File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -157,17 +157,21 @@ def grabclipboard():
157
157
raise NotImplementedError (msg )
158
158
159
159
p = subprocess .run (args , capture_output = True )
160
- err = p .stderr .decode ()
161
160
if p .returncode != 0 :
162
161
allowed_errors = [
163
- "Nothing is copied" , # wl-paste, when the clipboard is empty
164
- "not available" , # wl-paste/debian xclip, when an image isn't available
165
- "cannot convert" , # xclip, when an image isn't available
166
- "There is no owner" , # xclip, when the clipboard isn't initialized
162
+ # wl-paste, when the clipboard is empty
163
+ b"Nothing is copied" ,
164
+ # wl-paste/debian xclip, when an image isn't available
165
+ b"not available" ,
166
+ # xclip, when an image isn't available
167
+ b"cannot convert" ,
168
+ # xclip, when the clipboard isn't initialized
169
+ b"There is no owner" ,
167
170
]
171
+ err = p .stderr
168
172
if any (e in err for e in allowed_errors ):
169
173
return None
170
- msg = f"{ args [0 ]} error: { err .strip () if err else 'Unknown error' } "
174
+ msg = f"{ args [0 ]} error: { err .strip (). decode () if err else 'Unknown error' } "
171
175
raise ChildProcessError (msg )
172
176
173
177
data = io .BytesIO (p .stdout )
You can’t perform that action at this time.
0 commit comments