mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-01 00:17:27 +03:00 
			
		
		
		
	Simplified code
This commit is contained in:
		
							parent
							
								
									6998f34768
								
							
						
					
					
						commit
						d3205fae19
					
				|  | @ -158,7 +158,8 @@ def grabclipboard(): | ||||||
| 
 | 
 | ||||||
|         p = subprocess.run(args, capture_output=True) |         p = subprocess.run(args, capture_output=True) | ||||||
|         if p.returncode != 0: |         if p.returncode != 0: | ||||||
|             allowed_errors = [ |             err = p.stderr | ||||||
|  |             for silent_error in [ | ||||||
|                 # wl-paste, when the clipboard is empty |                 # wl-paste, when the clipboard is empty | ||||||
|                 b"Nothing is copied", |                 b"Nothing is copied", | ||||||
|                 # wl-paste/debian xclip, when an image isn't available |                 # wl-paste/debian xclip, when an image isn't available | ||||||
|  | @ -167,10 +168,9 @@ def grabclipboard(): | ||||||
|                 b"cannot convert", |                 b"cannot convert", | ||||||
|                 # xclip, when the clipboard isn't initialized |                 # xclip, when the clipboard isn't initialized | ||||||
|                 b"There is no owner", |                 b"There is no owner", | ||||||
|             ] |             ]: | ||||||
|             err = p.stderr |                 if err in silent_error: | ||||||
|             if any(e in err for e in allowed_errors): |                     return None | ||||||
|                 return None |  | ||||||
|             msg = f"{args[0]} error" |             msg = f"{args[0]} error" | ||||||
|             if err: |             if err: | ||||||
|                 msg += f": {err.strip().decode()}" |                 msg += f": {err.strip().decode()}" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user