mhammond / pywin32

Python for Windows (pywin32) Extensions
4.91k stars 783 forks source link

win32clipboard.SetClipboardData gets error or crashes #2132

Open michaeldengxyz opened 9 months ago

michaeldengxyz commented 9 months ago

my codes:

import win32clipboard
import win32con

text = '18621312165'
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, text)        
win32clipboard.CloseClipboard()

""" Platform: Windows-10-10.0.22621-SP0 python 3.10.9 pywin32 302/305/306

    !!!! when text is number only, such as, 
        ---- gets error: pywintypes.error: (6, 'SetClipboardData', 'handle is invalid!'), when text='201920'
        ---- or crashes without error message, when text='18621312165'
    !!!!

"""

oXoi commented 2 months ago

same,win11 23H2 22361.3155 Python 3.11.5 it only happens when the value is full digit