Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <mailman.149.1718674435.2909.python-list@python.org>
Deutsch   English   Français   Italiano  
<mailman.149.1718674435.2909.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: MRAB <python@mrabarnett.plus.com>
Newsgroups: comp.lang.python
Subject: Re: win32clipboard writing to clipboard on Windows 11
Date: Tue, 18 Jun 2024 02:30:46 +0100
Lines: 54
Message-ID: <mailman.149.1718674435.2909.python-list@python.org>
References: <f6e408ad-89c1-42b0-a771-d3677692f610@btinternet.com>
 <7e8c9107-6f71-4c49-a78b-ac5094073499@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de aV+yDCcujSpeH5tm4YM+1g+lR1ObD02fC/Q7o0OcHaOw==
Cancel-Lock: sha1:ojSDvp1DICHE8SG9N9QBPPIf0s4= sha256:8wFcnzoBXz2XxD6viai/RsgkZhrJL5Bo0Aq+UiW5wUM=
Return-Path: <python@mrabarnett.plus.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=plus.com header.i=@plus.com header.b=P9fAa2ZE;
 dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'this:':
 0.03; 'traceback': 0.04; '(most': 0.05; 'last):': 0.05;
 'subject:Windows': 0.07; 'acquired': 0.09; 'from:addr:python':
 0.09; 'output:': 0.09; 'received:192.168.1.64': 0.09;
 'subject:writing': 0.09; 'import': 0.15; 'memory': 0.15;
 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16;
 'message-id:@mrabarnett.plus.com': 0.16; 'program:': 0.16;
 'received:plus.net': 0.16; 'wrote:': 0.16; 'problem': 0.16;
 'uses': 0.19; 'to:addr:python-list': 0.20; 'machine': 0.22;
 'laptop': 0.23; 'anyone': 0.25; 'tried': 0.26; 'old': 0.27; '>>>':
 0.28; 'recently': 0.29; 'this?': 0.29; 'error': 0.29; 'header
 :User-Agent:1': 0.30; 'putting': 0.31; 'program': 0.31; '"",':
 0.32; 'do.': 0.32; 'encountered': 0.32; 'python-list': 0.32;
 'received:192.168.1': 0.32; 'windows': 0.34; 'same': 0.34; 'header
 :In-Reply-To:1': 0.34; 'running': 0.34; "skip:' 10": 0.37;
 'using': 0.37; "it's": 0.37; 'received:192.168': 0.37; 'file':
 0.38; 'text': 0.39; 'handle': 0.39; 'use': 0.39; 'wishes': 0.40;
 'something': 0.40; 'best': 0.61; 'sample': 0.61; 'skip:o 10':
 0.61; 'received:212': 0.62; 'url-ip:104.18/16': 0.67; 'shed':
 0.69; 'subject:skip:w 10': 0.76; '11;': 0.84; 'rob': 0.84;
 'consists': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
 t=1718674247; bh=fKvj6Xx9Ls35sgYxmmI1LAdyqd7mdaUxUETgRLU1l1k=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=P9fAa2ZE4OolmHGq+b4YdlyePchCI66hCEpynu87+dwflGUpZL6wflXrqj+7lLuC2
 2b5Dmp1/WHxt32F660sg/Q/dkJvEDQSU0m4f3hmuDw/Fj9I+47q2xyaWbY5BmZRA0a
 GAgOxjqm0QFkveiOCN1OQ5oUdSVvvgT/v6mrZfSghjTDXT347OPHu8hYRuuRO77eZq
 PhHYzPCGNT6LTerelOnF1zPwfaAj3kht5JVoWraPxBollbC0BLFR64TzE5/kIv2Fr6
 Q2REQm2ONz7eVVxhNzCNzeag8Ze674V+cz4s/3PY7Bs/8v8vSFuxmQOyfY8isaqg/o
 iZjvXixlLOeVQ==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.4 cv=fLma3oae c=1 sm=1 tr=0 ts=6670e347
 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
 a=IkcTkHD0fZMA:10 a=uPZiAMpXAAAA:8 a=jc8twOumPSAfDUad3HgA:9 a=3ZKOabzyN94A:10
 a=QEXdDO2ut3YA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <f6e408ad-89c1-42b0-a771-d3677692f610@btinternet.com>
X-CMAE-Envelope: MS4xfNHSSg7zMGs87FgZBQ76sRbRj4kIWakqVs2mzNIsHSmwQHMrUDPWGLrtp4qB9RdutACNduUS9/Tm8T7tKiBfPvCHUuPRANWoahuOwa9xN0aBf1sU1X7w
 ZcurubU/jPrXyFB+j5VTkoQQAr3wyF0SZxLBRu4k1qpYoGgKxHFT/+LcoWVnF5KH8x2p/eUl7fUzAaSHkwY3w/HOZ5UV+PtpnmE=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <7e8c9107-6f71-4c49-a78b-ac5094073499@mrabarnett.plus.com>
X-Mailman-Original-References: <f6e408ad-89c1-42b0-a771-d3677692f610@btinternet.com>
Bytes: 6334

On 2024-06-17 20:27, Rob Cliffe via Python-list wrote:
> 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

I tried it on Windows 10 and got this:

 >>> from win32clipboard import *
 >>> OpenClipboard()
 >>> SetClipboardData(CF_UNICODETEXT, "A")
1830508101640
 >>> CloseClipboard()
 >>> OpenClipboard()
 >>> SetClipboardData(CF_UNICODETEXT, "0")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
pywintypes.error: (6, 'SetClipboardData', 'The handle is invalid.')
 >>> CloseClipboard()

It looks like it's something to memory ownership:

https://stackoverflow.com/questions/1264137/how-to-copy-string-to-clipboard-in-c

If you're putting text on the clipboard, why not just use 
SetClipboardText()? That's what I do.