🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@radarhere
Copy link
Member

Resolves #7133

The user is intermittently hitting

Pillow/src/display.c

Lines 439 to 440 in 2467db4

if (!OpenClipboard(NULL)) {
PyErr_SetString(PyExc_OSError, "failed to open clipboard");

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-openclipboard states

OpenClipboard fails if another window has the clipboard open.

If the error is hit, this PR pauses for 0.5s, and then tries again.

@siteng98
Copy link

I think this would work great!

@hugovk hugovk merged commit 3568df8 into python-pillow:main Jun 6, 2023
@radarhere radarhere deleted the grabclipboardwin32 branch June 6, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImageGrab gives OSError randomly

3 participants