Recently I switched from Python 3.8.3 to Python 3.11.4. A strange
problem appeared which was not there before:
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.
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 "R:\W.PY", line 8, in <module>
SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is available')
I can get round the problem by using SetClipboardText(). But can anyone shed light on this?
Recently I switched from Python 3.8.3 to Python 3.11.4. A strange
problem appeared which was not there before:
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.
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 "R:\W.PY", line 8, in <module>
SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is available')
I can get round the problem by using SetClipboardText(). But can anyone shed light on this?
Recently I switched from Python 3.8.3 to Python 3.11.4. A strange
problem appeared which was not there before:
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.
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 "R:\W.PY", line 8, in <module>
SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is
available')
I can get round the problem by using SetClipboardText(). But can
anyone shed light on this?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 24:35:25 |
Calls: | 10,390 |
Calls today: | 1 |
Files: | 14,064 |
Messages: | 6,417,013 |