asweigart / pyperclip

Python module for cross-platform clipboard functions.
https://pypi.python.org/pypi/pyperclip
BSD 3-Clause "New" or "Revised" License
1.6k stars 193 forks source link

I got a weird bug #237

Open luis-arch opened 1 year ago

luis-arch commented 1 year ago

In the following code, I try to determine whether the clipboard has changed, so as to execute the function of the clipboard change. But the clipboard change function is called many times without any change in the clipboard itself. I didn't encounter problems during the debugging process, but when I actually ran the code, an error occurred. I feel like I'm making a very basic problem, but I can't figure out what I'm doing wrong. The python version I am running is 3.6. The version of pyperclip running is 1.8.2.

image

dutkulang commented 1 year ago

the issue is in your code not with pyperclip

timbr0wn commented 1 year ago

You may want to try the pyperclip.waitForNewPaste() function, which blocks until the text on the clipboard has changed.

It also has a optional timeout parameter which can be set to your desired timeout, in seconds.

If not provided, the timeout defaults to None.