Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #196279 > unrolled thread
| Started by | Rob Cliffe <rob.cliffe@btinternet.com> |
|---|---|
| First post | 2024-06-17 20:27 +0100 |
| Last post | 2024-06-17 20:27 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
win32clipboard writing to clipboard on Windows 11 Rob Cliffe <rob.cliffe@btinternet.com> - 2024-06-17 20:27 +0100
| From | Rob Cliffe <rob.cliffe@btinternet.com> |
|---|---|
| Date | 2024-06-17 20:27 +0100 |
| Subject | win32clipboard writing to clipboard on Windows 11 |
| Message-ID | <mailman.145.1718652657.2909.python-list@python.org> |
Recently I acquired a new laptop running WIndows 11; my previous one
uses WIndows 10. I encountered a strange problem:
I am using the win32clipboard backage (part of pywin32), and when I use
SetClipboardData() to write text which consists ***entirely of digits***
to the clipboard, I either get an error (not always the same error
message) or a program crash. The problem does not appear if I use
SetClipboardText() instead. The problem does not occur on my old
machine (where I used the feature extensively).
Sample program:
from win32clipboard import *
OpenClipboard()
SetClipboardData(CF_UNICODETEXT, "A")
SetClipboardData(CF_UNICODETEXT, "A0")
SetClipboardData(CF_UNICODETEXT, "0A")
SetClipboardText("0", CF_UNICODETEXT)
print("OK so far")
SetClipboardData(CF_UNICODETEXT, "0")
CloseClipboard()
Sample output:
OK so far
Traceback (most recent call last):
File "C:\TEST*.PY", line 8, in <module>
SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is available')
Can anyone shed light on this?
Best wishes
Rob Cliffe
Back to top | Article view | comp.lang.python
csiph-web