Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Breadth-first search is the bulldozer of science. -- Randy Goebel


devel / comp.lang.python / Writing to clipboard in Python 3.11

SubjectAuthor
o Writing to clipboard in Python 3.11Rob Cliffe

1
Writing to clipboard in Python 3.11

<mailman.189.1699375506.3828.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24398&group=comp.lang.python#24398

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!feeder2.eternal-september.org!eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: rob.cli...@btinternet.com (Rob Cliffe)
Newsgroups: comp.lang.python
Subject: Writing to clipboard in Python 3.11
Date: Mon, 6 Nov 2023 00:51:03 +0000
Lines: 31
Message-ID: <mailman.189.1699375506.3828.python-list@python.org>
References: <71d3e1c6-6efa-4f78-aef5-de3997e244f7@btinternet.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de Z1U9r6MT9xrL7lUgEcF7yAOm4DpqS+2YGPu5IXEB9Z9Q==
Cancel-Lock: sha1:DJDE97PurCmi4jBaCFc+O5qMw+c= sha256:zEg5gYyNNJ+nampyZigBET7SICXPQK8EAsWlZU6OlqY=
Return-Path: <rob.cliffe@btinternet.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=btinternet.com header.i=@btinternet.com header.b=buY5GWCN;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'traceback': 0.04; '(most':
0.05; 'last):': 0.05; 'output:': 0.09; 'subject:Python': 0.12;
'import': 0.15; 'instead.': 0.16; 'program:': 0.16; 'problem':
0.16; 'python': 0.16; 'round': 0.19; 'to:addr:python-list': 0.20;
'anyone': 0.25; 'recently': 0.29; 'this?': 0.29; 'error': 0.29;
'header:User-Agent:1': 0.30; 'program': 0.31; 'to:name:python':
0.32; 'received:192.168.1': 0.32; 'but': 0.32; 'there': 0.33;
'same': 0.34; "skip:' 10": 0.37; 'using': 0.37;
'received:192.168': 0.37; 'file': 0.38; 'text': 0.39; 'use': 0.39;
'received:213': 0.40; 'wishes': 0.40; 'best': 0.61; 'sample':
0.61; 'skip:o 10': 0.61; 'shed': 0.69; 'rob': 0.84; 'consists':
0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btinternet.com;
s=btmx201904; t=1699231864;
bh=NW51S8f/6xTVJds6s1/YnsCDkHkYvIQ2dAAIn6BG7NY=;
h=Message-ID:Date:MIME-Version:From:Subject:To;
b=buY5GWCNWV9EzM0eF5j9y7zzRl/hedjOPqhATtUHLp4TSRqPGFwEJ2UHwrmNi07HzPeM3yDquIuzzKERxrK3MGwpbjxkeV/v/O2AEaTleVXGKeFWhlpiGgLdLpJn4VII6CC8qmDnLnioMyR+0+UVTPUv9/K/uPEQ6cEG7HOVMM4q2MiOF64EZxskwjM78ivnmo/zvVd2Pe2H0K+FppV0t7fvklzx1Yj0IhSj/F6VxUemiigY2bVNSJVpzrKxyGmRg9qMpQQ6mXIDaGGLsglN0rZZ3cfcx1+Wz1JBvwoocwpUTB9t8G/jZYdc6eS+FJjABpG6PuDdF8bU+XdDifttcw==
Authentication-Results: btinternet.com;
auth=pass (PLAIN) smtp.auth=rob.cliffe@btinternet.com;
bimi=skipped
X-SNCR-Rigid: 64CADCC509B71235
X-Originating-IP: [86.175.14.43]
X-OWM-Source-IP: 86.175.14.43 (GB)
X-OWM-Env-Sender: rob.cliffe@btinternet.com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvkedruddufedgvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhepkfffgggfhffuvfgtgfesthekredttddvjeenucfhrhhomheptfhosgcuvehlihhffhgvuceorhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomheqnecuggftrfgrthhtvghrnhepgeeuledvieelfeejffehtddujeeiveehheffueejuefgffeluddvjeefjeeitdehnecukfhppeekiedrudejhedrudegrdegfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegludelvddrudeikedruddrvddtkegnpdhinhgvthepkeeirddujeehrddugedrgeefpdhmrghilhhfrhhomheprhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomhdpnhgspghrtghpthhtohepuddprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrghdprhgvvhfkrfephhhoshhtkeeiqddujeehqddugedqgeefrdhrrghnghgvkeeiqddujeehrdgsthgtvghnthhrrghlphhluhhsrdgtohhmpdgruhhthhgpuhhsvghrpehrohgsrdgtlhhifhhfvgessghtihhnthgvrhhnvghtrdgtohhmpdhgvghokffrpefiuedpoffvtefjohhsthepshgrqdhprhguqdhrghhouhhtqddttdeh
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-SNCR-hdrdom: btinternet.com
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
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: <71d3e1c6-6efa-4f78-aef5-de3997e244f7@btinternet.com>
 by: Rob Cliffe - Mon, 6 Nov 2023 00:51 UTC

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?
Best wishes
Rob Cliffe

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor