[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-28 Thread Wolfgang Fahl


Wolfgang Fahl  added the comment:

Indeed this a request for improvement. Technically the software works as 
expected. Just thousands of programmers have extra debug effort at this tate of 
affairs as can be deducted from the view count in the stackoverflow questions. 
The extra step of looking up the column name from the binding number can be 
avoided as i have shown by my workaround. To hide the detail of 

   set it globally before doing that (sqlite3.paramstyle = 'named').

here in the bug report is not helpful. Part of the request is also to show the 
record number in executeMany - just to make lifer easier for users for sqlite3

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36172] csv module internal consistency

2020-08-28 Thread Josh Rosenberg


Change by Josh Rosenberg :


--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Fwd: Issue in installing Python (Windows 10)

2020-08-28 Thread 2QdxY4RzWzUUiLuE
On 2020-08-28 at 18:38:03 -0500,
Debasis Chatterjee  wrote:

> By the way, is there a site where I can login to see such mails and
> also manage mail notification options?

Better than that, you can have the emails themselves delivered directly
to your inbox:  https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41655] New Node may not be visited in lib2to3.refactor.RefactoringTool.traverse_by

2020-08-28 Thread Chrome


Chrome  added the comment:

you can run example.py to reproduce this bug.

--
Added file: https://bugs.python.org/file49434/example.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31749] Request: Human readable byte amounts in the standard library

2020-08-28 Thread Avram

Avram  added the comment:

I looked through a lot of the suggested libraries and they all seemed either 
too specific to an implementation or didn't fully implement compatibility. So I 
created Prefixed to prove out the implementation of of an expanded format 
specification for float would look like.

It implements 3 new format types:
- h: SI Decimal prefix (..., n, μ, m, k, M, G, ...)
- j: IEC Binary prefix (Ki, Mi, Gi, ...)
- J: Shortened IEC Binary prefix (K, M, G, ...)

It also implements a new flag, '!' that will add a space before the prefix.

For now, the math is pretty simple, if you cross a magnitude level it will go 
to that prefix. So 999 would be '999' and 1000 would be 1k.

I was thinking another format specification option '%' followed by a digit 
could be used to set the threshold of when to switch, so f'{950.0:%5.2h}' would 
be '0.95k', but f'{949.0:%5.2h}' would be '949.00'. Was going to think about it 
a little more before implementing.

I'd appreciate feedback on the library. Issues can be submitted here: 
https://github.com/Rockhopper-Technologies/prefixed/issues

https://pypi.org/project/prefixed/

--
nosy: +aviso

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41660] multiprocessing.Manager objects lose connection info

2020-08-28 Thread Tim Peters


Tim Peters  added the comment:

Weird. If I insert these between the two process starts:

import time
time.sleep(2)

then the producer produces the expected output:

at start: 666
at producer start: 666

and the program blows up instead when it gets to

print("in consumer:", self.val.value)

Same thing if, instead of a sleep, I put

producerprocess.join()

before starting the consumer.

If I change the tail end to:

producerprocess.start()
import time
time.sleep(2)
print(state_value)
consumerprocess = MyConsumer(state_value, state_ready)
consumerprocess.start()

then I see

at start: 666
at producer start: 666
Value('i', 42)

before it blows up in the consumer.  So `state_value` appears to survive 
intact, and mutated as intended, across the producer's life - but gets 
corrupted somehow when it's _also_ passed to the consumer.

Weirder ;-) , if I replace the tail with the ever-more elaborate:

producerprocess = MyProducer(state_value, state_ready)
producerprocess.start()
import time
time.sleep(2)
producerprocess.join()
print(state_value)

state_value.value = 13
producerprocess = MyProducer(state_value, state_ready)
producerprocess.start()
time.sleep(2)
producerprocess.join()
print(state_value)

consumerprocess = MyConsumer(state_value, state_ready)
consumerprocess.start()

then I see

at start: 666
at producer start: 666
Value('i', 42)
at producer start: 13
Value('i', 42)

before it blows up in the consumer - so it survived two full producer 
lifetimes!  So ... generalize ... change the tail to:


for i in range(10):
state_value.value = i
producerprocess = MyProducer(state_value, state_ready)
producerprocess.start()
producerprocess.join()
print(state_value)

consumerprocess = MyConsumer(state_value, state_ready)
consumerprocess.start()

and I see everything working fine before it blows up in the consumer:

at start: 666
at producer start: 0
Value('i', 42)
at producer start: 1
Value('i', 42)
at producer start: 2
Value('i', 42)
at producer start: 3
Value('i', 42)
at producer start: 4
Value('i', 42)
at producer start: 5
Value('i', 42)
at producer start: 6
Value('i', 42)
at producer start: 7
Value('i', 42)
at producer start: 8
Value('i', 42)
at producer start: 9
Value('i', 42)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-08-28 Thread mohamed koubaa


Change by mohamed koubaa :


--
pull_requests: +21101
pull_request: https://github.com/python/cpython/pull/21995

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41655] New Node may not be visited in lib2to3.refactor.RefactoringTool.traverse_by

2020-08-28 Thread Chrome


Change by Chrome :


--
versions: +Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41659] PEG discrepancy on 'if {x} {a}: pass'

2020-08-28 Thread Chrome


Change by Chrome :


--
versions: +Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41659] PEG discrepancy on 'if {x} {a}: pass'

2020-08-28 Thread Chrome


Change by Chrome :


--
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41660] multiprocessing.Manager objects lose connection info

2020-08-28 Thread Tim Peters


New submission from Tim Peters :

This started on StackOverflow:

https://stackoverflow.com/questions/63623651/how-to-properly-share-manager-dict-between-processes

Here's a simpler program.

Short course: an object of a subclass of mp.Process has an attribute of 
seemingly any type obtained from an mp.Manager(). The report above used a 
Manager.dict, and the program here a Manager.Value.

When .start() is invoked, the first time that attribute is used in any way that 
requires communication with the Manager server, the program dies. The output 
below is from 3.8.5 on Windows; the report above is some Linux flavor. The 
tracebacks are very similar, the only obvious difference being that the 
implementation complains about a socket on Linux but about a named pipe on 
Windows.

Note that there's no problem passing such things as explicit arguments to 
functions across processes. The loss here appears specific to the inscrutable 
under-the-covers pickle dance needed to create a "self" by magic on worker 
processes.

The code:

from multiprocessing import Process, Manager, Event

class MyProducer(Process):
def __init__(self, value, event):
Process.__init__(self)
self.val = value
self.event = event

def run(self):
print("at producer start:", self.val.value)
self.val.value = 42
self.event.set()

class MyConsumer(Process):
def __init__(self, value, event):
Process.__init__(self)
self.val = value
self.event = event

def run(self):
self.event.wait()
print("in consumer:", self.val.value)

if __name__ == "__main__":
state_value = Manager().Value('i', 666)
print("at start:", state_value.value)
state_ready = Event()
producerprocess = MyProducer(state_value, state_ready)
consumerprocess = MyConsumer(state_value, state_ready)
producerprocess.start()
consumerprocess.start()

The output:

at start: 666
Process MyProducer-2:
Traceback (most recent call last):
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py",
 line 827, in _callmethod
conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py",
 line 315, in _bootstrap
self.run()
  File "C:\Code\temp.py", line 10, in run
print("at producer start:", self.val.value)
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py",
 line 1154, in get
return self._callmethod('get')
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py",
 line 831, in _callmethod
self._connect()
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py",
 line 818, in _connect
conn = self._Client(self._token.address, authkey=self._authkey)
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\connection.py",
 line 500, in Client
c = PipeClient(address)
  File 
"C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\connection.py",
 line 702, in PipeClient
_winapi.WaitNamedPipe(address, 1000)
FileNotFoundError: [WinError 2] The system cannot find the file specified

--
components: Library (Lib)
messages: 376051
nosy: tim.peters
priority: normal
severity: normal
status: open
title: multiprocessing.Manager objects lose connection info
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Fwd: Issue in installing Python (Windows 10)

2020-08-28 Thread Debasis Chatterjee
-- Forwarded message -
From: Debasis Chatterjee 
Date: Fri, Aug 28, 2020 at 3:41 AM
Subject: Re: Issue in installing Python (Windows 10)
To: Terry Reedy 


Hi Terry,

OK.

I think the issue is now solved.
I used "pip uninstall" and then "pip install".

With that I can run Python programs that use the installed packages.

By the way, is there a site where I can login to see such mails and also
manage mail notification options?
The same as
https://python-forum.io/member.php ?
Or another one?

Thank you

Debasis

On Wed, Aug 26, 2020 at 5:03 PM Debasis Chatterjee 
wrote:

> Hi Terry,
>
> I still have the issue. I took help from my company's IT Admin and
> deinstalled everything and then made fresh installation.
>
> Still have issues the packages.
>
> Such as we need SEGYIO in the program. Program fails to find that.
>
> When I try to add using "pip" then I get this message.
>
> C:\Users\debasisc>pip install segyio
> Defaulting to user installation because normal site-packages is not
> writeable
> Requirement already satisfied: segyio in
> c:\users\debasisc\appdata\roaming\python\python38\site-packages (1.9.1)
> Requirement already satisfied: numpy>=1.10 in
> c:\users\debasisc\appdata\roaming\python\python38\site-packages (from
> segyio) (1.19.1)
> WARNING: You are using pip version 20.1.1; however, version 20.2.2 is
> available.
> You should consider upgrading via the 'c:\program files
> (x86)\python38-32\python.exe -m pip install --upgrade pip' command.
>
> What do you suggest for troubleshooting?
>
> Thank you
>
> Debasis
>
> On Mon, Aug 24, 2020 at 3:19 PM Terry Reedy  wrote:
>
>> On 8/23/2020 12:39 PM, Debasis Chatterjee wrote:
>>
>> > I started off by using "python-3.8.5.exe".
>>
>> 32-bit Windows installer?  Windows version might be relevant.
>>
>> > I use "Run as Administrator" option to click this (provide my
>> local-admin
>> > username/pwd).
>>
>> > After this, I see python shell available. But no IDLE. Not sure why?
>>
>> You mean no IDLE entry on Python 3.8 directory on Start menu?
>>
>> Installer has a checkbox for tkinter and IDLE.  It is on by default for
>> a fresh install but I expect it defaults to previous install for
>> reinstalls.
>>
>> On a command line, run 'python -c "import tkinter' to see if you have
>> tkinter.  'python -m idlelib' starts IDLE if present.
>>
>> >  From CMD, I can check "pip list". Surprisingly, it shows me packages
>> that I
>> > installed earlier, before deinstalling and reinstalling.
>>
>> De-installing does not remove pythonxy directory if you add anything to
>> it.
>>
>> > Something is not right. Hence I am trying to make a fresh restart.
>> >
>> > One thing odd is that even after removing installed program (Python)
>> from
>> > control panel, I still find that from "Start".
>>
>> Have you installed more than one version of Python?  Or both 32 and 64
>> bit variation of same Python version?
>>
>>
>> --
>> Terry Jan Reedy
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24160] Pdb sometimes raises exception when trying to remove a breakpoint defined in a different debugger session

2020-08-28 Thread Irit Katriel


Change by Irit Katriel :


--
title: Pdb sometimes crashes when trying to remove a breakpoint defined in a 
different debugger sessoon -> Pdb sometimes raises exception when trying to 
remove a breakpoint defined in a different debugger session
versions: +Python 3.10 -Python 2.7, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-28 Thread Evens Fortuné

Evens Fortuné  added the comment:

I don't think this is a bug. As I have explained in the answer I have provided 
on StackOverflow 
(https://stackoverflow.com/posts/comments/112539410?noredirect=1), it seems 
that sqlite3 uses by default the qmark parameter substitution style for their 
query which uses a tuple to provide it with its values. So it makes sense that 
the error message only does reference the index number since the matching is 
done on the order where a parameter appear on the SQL query and the same order 
in the tuple provided.

Here @Wolfgang seems to try to use the named parameter substitution style 
because he is using a dictionary to provide the values to the query. You have 
to set it globally before doing that (sqlite3.paramstyle = 'named').

So from my point of view there is no bug here.

--
nosy: +EvensF

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20119] pdb c(ont(inue)) optional one-time-only breakpoint (like perl debugger)

2020-08-28 Thread Irit Katriel


Irit Katriel  added the comment:

Pdb already has this, it's the tbreak command.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41513] High accuracy math.hypot()

2020-08-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +21100
pull_request: https://github.com/python/cpython/pull/21994

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41659] PEG discrepancy on 'if {x} {a}: pass'

2020-08-28 Thread Guido van Rossum


New submission from Guido van Rossum :

I just noticed a subtle discrepancy between the old parser and the PEG parser.

Consider this syntax error:
```
if x {a}: pass
```
The old parser places the caret at the '{':
```
$ python3.8 -c 'if x { a } : pass'
  File "", line 1
if x { a } : pass
 ^
SyntaxError: invalid syntax
```
The PEG parser puts it at 'a':
```
$ python3.10 -c 'if x { a } : pass'
  File "", line 1
if x { a } : pass
   ^
SyntaxError: invalid syntax
```

I don't think we should put much effort into fixing it -- it's just a 
curiosity. I suspect it's got to do with some lookahead.

--
assignee: lys.nikolaou
messages: 376048
nosy: gvanrossum, lys.nikolaou
priority: low
severity: normal
stage: needs patch
status: open
title: PEG discrepancy on 'if {x} {a}: pass'
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread Ben Bacarisse
Shivlal Sharma  writes:

> I have seen this code on one of competative programming site but I
> didn't get it, Why output is 9?
>
> from functools import *
>
> def ADDS(a,b):
> return a+1
> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> add = reduce(ADDS, nums)
> print(add)
>
> output: 9

Hint:

reduce(f, [e1, e2]) is f(e1, e2)
reduce(f, [e1, e2, e3]) is f(f(e1, e2), e3)
reduce(f, [e1, e2, e3, e4]) is f(f(f(e1, e2), e3), e4)

Replace f with a function that adds one to its first argument.  Does
that help?

-- 
Ben.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 12:26, Chris Green  wrote:
>Cameron Simpson  wrote:
>> POP3 is presumably handing you bytes containing a message. If the 
>> Python
>> email.BytesParser doesn't handle it, stash the raw bytes _elsewhere_ in
>> a distinct file in some directory.
>>
>> with open('evil_msg_bytes', 'wb') as f:
>> for bs in bbb:
>> f.write(bs)
>>
>> No interpreation requires, since parsing failed. Then you can start
>> dealing with these exceptions. _Do not_ write unparsable messages into
>> an mbox!
>>
>Maybe I shouldn't but Python 2 has been managing to do so for several
>years without any issues.  I know I *could* put the exceptions in a
>bucket somewhere and deal with them separately but I'd really rather
>not.
>
>At prsent (with the Python 2 code still installed) it all 'just works'
>and the absolute worst corruption I ever see in an E-Mail is things
>like accented characters missing altogether or £ signs coming out as a
>funny looking string.  Either of these don't really make the message
>unintelligible.
>
>Are we saying that Python 3 really can't be made to handle things
>'tolerantly' like Python 2 used to?

It can, but if you're decoding bytes to strings without the correct 
encoding then rubbish will be happening. In Python 2 also, it just isn't 
being flagged.

One approach would be to break your parser process up:

- collect bytes from POP3
- parse headers for filtering purposes
- those you keep, append to the mbox _as bytes_

It sounds like your filter is uninterested in the message body, so you 
don't need to decode it at all. Just ensure the bod has no embedded 
lines with b'From ' at the start, and ensure the last line ends in a 
newline b'\n' or that you append one, so that the b'From ' of the next 
message is recognised.

So: collect bytes, decode ehaders and parse/filter, save _bytes_.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41658] http.client not allowing non-ascii in headers

2020-08-28 Thread Aliona Matveeva


New submission from Aliona Matveeva :

http.client trying to decode any header with 'latin-1', which fails when there 
is any non-ascii symbols in it, for example, Cyrillic. 

I propose to check if it's non-ascii and then decode it with 'utf-8', works 
perfectly.

--
components: Library (Lib)
messages: 376047
nosy: yellalena
priority: normal
severity: normal
status: open
title: http.client not allowing non-ascii in headers
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41657] Refactor for object source files variable in Makefile

2020-08-28 Thread Elian Mariano Gabriel


Change by Elian Mariano Gabriel :


--
keywords: +patch
pull_requests: +21099
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21993

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



RE: How do I place a preset into the text box?

2020-08-28 Thread Steve
Works like a charm, special thanks.
Steve

=

Footnote:
He called his wife to see if he should pick up Fish and Chips on the way
home.  She hung up on him.  She is still fuming over letting him name the
kids.

-Original Message-
From: Python-list  On
Behalf Of Cousin Stanley
Sent: Friday, August 28, 2020 7:47 AM
To: python-list@python.org
Subject: Re: How do I place a preset into the text box?

Steve wrote:

> The following program compiles but does not quite do what I would like 
> it to do. Line 19 is the preset information but I do not seem to be 
> able to get it into the form by code.  My purpose is to let the user 
> make changes without having to re-enter the entire code.
> 

You might consider moving the entry  get()  function into the  Submit()
call back 

def Submit() :

label.configure( text = 'The new code is : ' + NewCode.get() )

x = ( NewCode.get() )

print( "\n  The new code entered is :  " + x )



The following  insert  function will show the OldCode in the  entry  box

 
OldCode = ( "1234-abcd" )

# 

CodeEntered = ttk.Entry( window , width = 15 , textvariable = NewCode )

CodeEntered.grid( column = 2 , row = 3 , pady = 10 )

CodeEntered.insert( 0 , OldCode )


--
Stanley C. Kitching
Human Being
Phoenix, Arizona

--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How do I place a preset into the text box?

2020-08-28 Thread Steve
Yes, the form/window now closes properly.

Removal of sys.exit() and inserting window.destroy() cleared up the exiting
problem.

 

Thanks.  

I saw several variations on that but I guess I just never twerked it enough.

 

 

Footnote:
"What rhymes with orange?"
"No it doesn't.."

 

From: Colin McPhail  
Sent: Friday, August 28, 2020 7:46 AM
To: Chris Narkiewicz via Python-list 
Cc: Steve 
Subject: Re: How do I place a preset into the text box?

 

Hi Steve,





On 28 Aug 2020, at 11:03, Steve mailto:Gronicus@SGA.Ninja> > wrote:

 


The following program compiles but does not quite do what I would like it to
do. Line 19 is the preset information but I do not seem to be able to get it
into the form by code.  My purpose is to let the user make changes without
having to re-enter the entire code.

 

I'm no Tk expert but does the following do what you want? (Strictly
speaking, the parentheses in ("1234-abcd") are not wrong just unnecessary.)

 

#===

import tkinter as tk

from tkinter import ttk

import sys

 

window = tk.Tk()

window.title("Python Tkinter Text Box")

window.minsize(600,400)

 

def Submit():

   label.configure(text= 'The new code is: ' + NewCode.get())

 

def ClickExit():

   #This exit closes the program but the form remains and is still active.

   # I want only to close the form.

   print("Exiting")

   #sys.exit()

   window.destroy()

 

#OldCode = ("1234-abcd")

OldCode = "1234-abcd"

 

label = ttk.Label(window, text = "Enter the new code")

label.grid(column = 1, row = 1)

 

#NewCode = tk.StringVar()

NewCode = tk.StringVar(value=OldCode)

 

CodeEntered = ttk.Entry(window, width = 15, textvariable = NewCode)

CodeEntered.grid(column = 2, row = 3)

 

button = ttk.Button(window, text = "Submit", command = Submit)

button.grid(column= 2, row = 5)

 

button = ttk.Button(window, text = "Quit", command = ClickExit)

button.grid(column= 2, row = 7)

 

window.mainloop()

 

x = (NewCode.get())

print("The new code entered is: " + x)

 

#=

 

Regards,

Colin

 

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33337] Provide a supported Concrete Syntax Tree implementation in the standard library

2020-08-28 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
nosy: +lys.nikolaou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41059] Large number of Coverity reports for parser.c

2020-08-28 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> works for me
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41059] Large number of Coverity reports for parser.c

2020-08-28 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

I propose that we take no further action and close this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41657] Refactor for object source files variable in Makefile

2020-08-28 Thread Elian Mariano Gabriel


New submission from Elian Mariano Gabriel :

Refactoring in the Makefile is needed due a hard coded declaration to the 
'OBJECT_OBJS' variable in the line 388.

This hard coded declaration can be replaced by a pattern substitution function 
which assigns the 'OBJECT_OBJS' variable in this much simpler way:

OBJECT_OBJS=$(patsubst %.c, %.o, $(wildcard Objects/*.c))

This assignment will facilitate the future builds because it is not need to add 
a new obj reference when created a new source code inside the 'Objects' folder.

--
components: Build
messages: 376045
nosy: ElianMariano
priority: normal
severity: normal
status: open
title: Refactor for object source files variable in Makefile
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24160] Pdb sometimes crashes when trying to remove a breakpoint defined in a different debugger sessoon

2020-08-28 Thread Irit Katriel


Irit Katriel  added the comment:

I've submitted a patch that I believe fixes this problem. It adds in Bdb's 
__init__ a call to a function that reads the Breakpoint's 'bplist' and 
'bpbynumber' class attributes and populates the new instances' 'breaks' dict.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24160] Pdb sometimes crashes when trying to remove a breakpoint defined in a different debugger sessoon

2020-08-28 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 4.0 -> 5.0
pull_requests: +21098
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21989

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Video file to subtitles file

2020-08-28 Thread Chris Angelico
On Sat, Aug 29, 2020 at 3:24 AM Barry  wrote:
>
>
>
> > On 28 Aug 2020, at 17:37, Muskan Sanghai  wrote:
> >
> > On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote:
>  On 27 Aug 2020, at 18:00, Muskan Sanghai  wrote:
> >>>
> >>> I would be really thankful if someone can suggest me how can I generate 
> >>> subtitles file (srt format) from a video or audio without using Google 
> >>> cloud and AWS.
> >> What do you know about how subtitles work with video? Do you mean you want 
> >> to extract the bitmap subtitle data from a MPEG video?
> >>
> >> Barry
> >>
> >>
> >>
> >>> --
> >>> https://mail.python.org/mailman/listinfo/python-list
> >>>
> >
> > Thank you Barry for your reply,
> > I just know the basics and I want to extract subtitles from a MPEG video 
> > and then put the subtitles in that same video. Subtitles can be of any 
> > format but it should be convenient for the entire procedure.
>
> It seems you are looking for an App to do this work?
> I searched the web and saw this.
>
> https://www.openshot.org/
>
> I have not used this app, maybe it’s a starting point for you.
>
> Barry
>

Not familiar with Openshot, but it's worth looking into.
Alternatively, I'd definitely recommend ffmpeg for anything like this
sort of job. But if you actually need to OCR something, then you may
need to do some scripting work. I don't have code to offer you, but it
would involve FFMPEG to lift the images, something like Tesseract to
do the actual OCRing, and then you'd write the rest of it yourself in
Python.

Other than that, this probably is something best done with a dedicated
movie editing tool, not Python. Use what exists.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Video file to subtitles file

2020-08-28 Thread Barry


> On 28 Aug 2020, at 17:37, Muskan Sanghai  wrote:
> 
> On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote:
 On 27 Aug 2020, at 18:00, Muskan Sanghai  wrote: 
>>> 
>>> I would be really thankful if someone can suggest me how can I generate 
>>> subtitles file (srt format) from a video or audio without using Google 
>>> cloud and AWS.
>> What do you know about how subtitles work with video? Do you mean you want 
>> to extract the bitmap subtitle data from a MPEG video? 
>> 
>> Barry 
>> 
>> 
>> 
>>> -- 
>>> https://mail.python.org/mailman/listinfo/python-list 
>>> 
> 
> Thank you Barry for your reply,
> I just know the basics and I want to extract subtitles from a MPEG video and 
> then put the subtitles in that same video. Subtitles can be of any format but 
> it should be convenient for the entire procedure.

It seems you are looking for an App to do this work?
I searched the web and saw this.

https://www.openshot.org/

I have not used this app, maybe it’s a starting point for you.

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41487] Builtin bigint modulo operation can be made faster when the base is divisible by a large power of 2 (i.e: has many trailing 0 digits in binary)

2020-08-28 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Video file to subtitles file

2020-08-28 Thread Muskan Sanghai
On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote:
> > On 27 Aug 2020, at 18:00, Muskan Sanghai  wrote: 
> > 
> > I would be really thankful if someone can suggest me how can I generate 
> > subtitles file (srt format) from a video or audio without using Google 
> > cloud and AWS.
> What do you know about how subtitles work with video? Do you mean you want to 
> extract the bitmap subtitle data from a MPEG video? 
> 
> Barry 
> 
> 
> 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list 
> >

Thank you Barry for your reply,
I just know the basics and I want to extract subtitles from a MPEG video and 
then put the subtitles in that same video. Subtitles can be of any format but 
it should be convenient for the entire procedure.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41649] Can't pass Path like objects to subprocess api's on Windows.

2020-08-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not understand how you get this result. At that line of code arg can only 
be string, because it is a result of os.fsdecode(). Are you sure that you use 
Python version which includes issue31961 changes? What exactly Python version 
do you use?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41624] typing.Coroutine documentation

2020-08-28 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41624] typing.Coroutine documentation

2020-08-28 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset c01a7edc67e2c2e13a6d9513f111f27761786e27 by Karthikeyan 
Singaravelan in branch '3.9':
[3.9] bpo-41624: fix documentation of typing.Coroutine (GH-21952) (#21982)
https://github.com/python/cpython/commit/c01a7edc67e2c2e13a6d9513f111f27761786e27


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41624] typing.Coroutine documentation

2020-08-28 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 838316db08a8e3174e4cf8db233ff69d388b3f5c by Karthikeyan 
Singaravelan in branch '3.8':
[3.8] bpo-41624: fix documentation of typing.Coroutine (GH-21952). (#21983)
https://github.com/python/cpython/commit/838316db08a8e3174e4cf8db233ff69d388b3f5c


--
nosy: +gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread Peter Otten
Shivlal Sharma wrote:

> I have seen this code on one of competative programming site but I didn't
> get it, Why output is 9?
> 
> from functools import *
> 
> def ADDS(a,b):
> return a+1
> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> add = reduce(ADDS, nums)
> print(add)
> 
> output: 9

Rewrite the ADDS() function like so

>>> def ADDS(a, b):
... result = a + 1
... print(f"ADDS({a}, {b}) --> {result}")
... return result
... 

to see what's going on:

>>> reduce(ADDS, [1,2,3,4,5,6,7,8,9])
ADDS(1, 2) --> 2
ADDS(2, 3) --> 3
ADDS(3, 4) --> 4
ADDS(4, 5) --> 5
ADDS(5, 6) --> 6
ADDS(6, 7) --> 7
ADDS(7, 8) --> 8
ADDS(8, 9) --> 9
9

ADDS is called with the first two values, 
then with the first result (first value + 1) and the third value
then the second result ((first value + 1) + 1) and the fourth value...
This can be written recursively as 

ADDS(ADDS(ADDS(ADDS(ADDS(ADDS(ADDS(ADDS(1, 2), 3), 4), 5), 6), 7), 8), 9)

As the second argument is always discarded we get the first a=1 eight times 
incremented by one, i.e 9. 

To drive the point home that we always get
first item + (len(items) -1):


>>> reduce(ADDS, [42,"a","b","c","d"])
ADDS(42, a) --> 43
ADDS(43, b) --> 44
ADDS(44, c) --> 45
ADDS(45, d) --> 46
46





-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread David Raymond
All the numbers in the nums list don't matter and aren't used. Only the first 
number, and how many there are.
https://docs.python.org/3.8/library/functools.html#functools.reduce

Basically it's doing
ADDS(1, 2) which returns 2
that 2 gets fed back into
ADDS(2, 3) which returns 3
that 3 gets fed back into
ADDS(3, 4) which returns 4
...
ADDS(8, 9) which returns 9

> I have seen this code on one of competative programming site but I didn't get 
> it, Why output is 9?
> 
> from functools import *
> 
> def ADDS(a,b):
> return a+1
> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> add = reduce(ADDS, nums)
> print(add)
> 
> output: 9
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41656] Sets are storing elements in sorted order.

2020-08-28 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Here's another example:

py> set([1, 2**63, 4, -5, 6, 5])
{1, 9223372036854775808, 4, 6, 5, -5}



By the way, in the future, please don't post screen shots of text, copy the 
code and output and paste it as text into your bug report. Screenshots make it 
hard for us to reproduce the bug, we have to re-type your code. And it makes it 
difficult for blind and visually impaired developers, who may be reading this 
with a screen-reader.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread Shivlal Sharma
I have seen this code on one of competative programming site but I didn't get 
it, Why output is 9?

from functools import *

def ADDS(a,b):
return a+1
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
add = reduce(ADDS, nums)
print(add)

output: 9
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:44 AM, Chris Green wrote:
> Stefan Ram  wrote:
>> Chris Green  writes:
>>> Therein lies the problem, the incoming byte stream *isn't* ASCII, it's
>>> an E-Mail message which may, for example, have UTF-8 or other encoded
>>> characters in it.  Hopefully it will have an encoding given in the
>>> header but that's only if the sender is 'well behaved', one needs to
>>> be able to handle almost anything and it must be done without 'manual'
>>> interaction.
>>   I would make a difference between "scoring" and "transport":
>>
>>   To transfer a message into an mbox it can be transferred as it is.
>>   Just the bytes from the POP3 server. Let mutt deal with them.
>>
> That's what I do at present in Python 2, the problem is that Python 3
> complains when I use the standard library to put the message into the
> mbox.
>
> I want to transport the message into my mbox and Python 3 won't do it
> without knowing how it's encoded whereas Python 2 just stuffed it in
> there 'as is'.
>
> I want Python 3's mailbox class to juyst put what I tell it (even if
> mis-formatted or mis-encoded) into the mbox.
>
It looks like the mailbox class has gotten 'pickier' in Python 3, and
won't accept a message as a byte string, just as either a email message
or a real string. My guess would be that 'simplest' path would be to
convert your message into a parsed Message class, and add that.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41656] Sets are storing elements in sorted order.

2020-08-28 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

"Unordered" means that the language doesn't promise any specific order, it 
doesn't mean that there is no order at all.

Try strings:

py> set("abcdef")
{'b', 'f', 'c', 'e', 'd', 'a'}


or different ints:

py> set([1, 0, -2])
{0, 1, -2}

--
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41642] Buildbot: workers detached every minute and "no space left on device" issue

2020-08-28 Thread David Edelsohn


David Edelsohn  added the comment:

I can provide some information from the logs of one of the buildbots, or change 
a parameter. Let me know.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 11:24 PM Chris Green  wrote:
>
> Chris Angelico  wrote:
> >
> > Also, if you're parsing an email message, you can and should be doing
> > so with respect to the encoding(s) stipulated in the headers, after
> > which you will have valid Unicode text.
> >
> But not all E-Mail messages are 'well behaved', the above works fine
> if the headers specify the correct text encoding but quite often one
> will get messages with no encoding specified and also one gets
> messages with the wrong encoding specified.  One needs a way to handle
> these 'rogue' messages such that most of the characters come out right.
>

As D'Arcy posted, this is what the error handling is for. If you want
to decode in a "sloppy" way such that mis-encoded text can be
partially decoded, then that's what you want to do - decode with a
sloppy error handler. Don't abuse arbitrary eight bit encodings in the
hope that it'll do a better job just because it doesn't spit out any
exceptions.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41655] New Node may not be visited in lib2to3.refactor.RefactoringTool.traverse_by

2020-08-28 Thread Chrome


Change by Chrome :


--
title: new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by 
-> New Node may not be visited in lib2to3.refactor.RefactoringTool.traverse_by

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41656] Sets are storing elements in sorted order.

2020-08-28 Thread Piyush Pravin


New submission from Piyush Pravin :

In documentation it is written that " Sets are unordered collection", but 
actually it is storing the elements in sorted order.

--
assignee: docs@python
components: Documentation
files: dndndgndghbdgngdndgngtn.PNG
messages: 376037
nosy: docs@python, piyushpravin1998
priority: normal
severity: normal
status: open
title: Sets are storing elements in sorted order.
type: resource usage
versions: Python 3.7
Added file: https://bugs.python.org/file49432/dndndgndghbdgngdndgngtn.PNG

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41651] Pip: Wrong Showing of Progressbar when Downloading Modules

2020-08-28 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread D'Arcy Cain
On 2020-08-28 08:30, Richard Damon wrote:
> This might be one of the cases where Python 2's lack handling of string
> vs bytes was an advantage.

For English speaking Americans.

> Python2 handled that sort of case quite easily. Python 3 on the other
> hand, will have issue converting the byte message to a string, since
> there isn't a single encoding that you could use for all of it all the
> time. This being 'fussier' does make sure that the program is handling
> all the text 'properly', and would be helpful if some of the patterns
> being checked for contained 'extended' (non-ASCII) characters.
> 
> One possible solution in Python3 is to decode the byte string using an
> encoding that allows all 256 byte values, so it won't raise any encoding
> errors, just give your possibly non-sense characters for non-ASCII text.

Or simply handle the errors in the way that makes sense for your
requirements.  Check the section on error handling here:

https://www.askpython.com/python/string/python-encode-and-decode-functions

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
A unit of Excelsior Solutions Corporation - Propelling Business Forward
http://www.VybeNetworks.com/
IM:da...@vybenetworks.com VoIP: sip:da...@vybenetworks.com



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41655] new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by

2020-08-28 Thread Chrome


Change by Chrome :


--
keywords: +patch
pull_requests: +21097
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21988

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41655] new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by

2020-08-28 Thread Chrome


Chrome  added the comment:

`lib2to3.refactor.RefactoringTool.traverse_by` do a pre-order or post-order 
traverse algorithm, and apply every candidate fixer to each node when traverse 
the tree. when a prior fixer add a new node that contains children, these 
children won't be visited by posterior fixers.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41655] new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by

2020-08-28 Thread Chrome


New submission from Chrome :

`lib2to3.refactor.RefactoringTool.traverse_by` do a pre-order or post-order, 
and apply every candidate fixer to each node when traverse the tree. when a 
prior fixer add a new node that contains children, these children won't be 
visited by posterior fixers.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 376035
nosy: chrome
priority: normal
severity: normal
status: open
title: new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Chris Angelico  wrote:
> 
> Also, if you're parsing an email message, you can and should be doing
> so with respect to the encoding(s) stipulated in the headers, after
> which you will have valid Unicode text.
> 
But not all E-Mail messages are 'well behaved', the above works fine
if the headers specify the correct text encoding but quite often one
will get messages with no encoding specified and also one gets
messages with the wrong encoding specified.  One needs a way to handle
these 'rogue' messages such that most of the characters come out right.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> I want to transport the message into my mbox and Python 3 won't do it
> without knowing how it's encoded whereas Python 2 just stuffed it in
> there 'as is'.
>
> I want Python 3's mailbox class to juyst put what I tell it (even if
> mis-formatted or mis-encoded) into the mbox.

I guess using the mailbox class already implies that you do _not_
want to "simply put the msgs into an mbox file" but rather want
the class to do what it was designed for: "put proper msgs properly
into an mbox file". We can't have it both ways I fear. If we
simply want to stuff a file with bytes and call that mbox we
should do so: drop the bytes into a file and call it an mbox file.

Karsten
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:39 AM, Chris Green wrote:
> Richard Damon  wrote:
>> On 8/28/20 7:50 AM, Karsten Hilbert wrote:
> No interpreation requires, since parsing failed. Then you can start
> dealing with these exceptions. _Do not_ write unparsable messages into
> an mbox!
>
 Maybe I shouldn't but Python 2 has been managing to do so for several
 years without any issues.
>>> I am inclined to congratulate you on that sheer amount of luck. I don't
>>> believe there were no issues because everything worked just right under
>>> py2 but rather because py2 cared less than py3 does now.
>>>
 Are we saying that Python 3 really can't be made to handle things
 'tolerantly' like Python 2 used to?
>>> It sure should be possible but it will require *explicit* en/decode()s in
>>> more places than before because AFAICT there's less impliciteness as to
>>> which encoding to apply (regardless of whether it applies).
>>>
>>> Karsten
>>>
>>>
>>>
>> This might be one of the cases where Python 2's lack handling of string
>> vs bytes was an advantage.
>>
>> If he was just scanning the message for specific ASCII strings, then not
>> getting the full message decoded write is unlikely to have been causing
>> problems.
>>
>> Python2 handled that sort of case quite easily. Python 3 on the other
>> hand, will have issue converting the byte message to a string, since
>> there isn't a single encoding that you could use for all of it all the
>> time. This being 'fussier' does make sure that the program is handling
>> all the text 'properly', and would be helpful if some of the patterns
>> being checked for contained 'extended' (non-ASCII) characters.
>>
>> One possible solution in Python3 is to decode the byte string using an
>> encoding that allows all 256 byte values, so it won't raise any encoding
>> errors, just give your possibly non-sense characters for non-ASCII text.
>>
> But this will simply get some things quite wrong and produce garbage
> won't it?  Whereas Python 2 would simply scramble the odd character.
>
Yes, when the message has extended characters, it will put the 'wrong'
characters into the message, but if you are only looking for a fixed set
of ASCII strings, especially in the headers of the message, that doesn't
matter, those will still be there. It is a pragmatic short cut,
something that is 'good enough' to get the job done, even if not 100%
correct.

As was elsewhere mentioned, you could also do at least most of the
processing as bytes (this may need converting some of the strings being
uses to bytes), but I don't know exactly what they are doing, so don't
know if there is something that really needs a string.

Basically, mail messages are complicated, and to 'properly' convert a
message into a format for proper analysis would be significant work (and
the result would NOT be a simple string), but it sounds like they didn't
need that level of work with the messages. Particually if they only need
to process the headers, and are working to try to 'whitelist' files to
get them, being close and simple is likely good enough,

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41654] Segfault when raising MemoryError

2020-08-28 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 10:51 PM Chris Green  wrote:
>
> > One possible solution in Python3 is to decode the byte string using an
> > encoding that allows all 256 byte values, so it won't raise any encoding
> > errors, just give your possibly non-sense characters for non-ASCII text.
> >
> But this will simply get some things quite wrong and produce garbage
> won't it?  Whereas Python 2 would simply scramble the odd character.
>

It would. Don't do that. Either keep it as bytes, or decode it using
the correct encoding.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Stefan Ram  wrote:
> Chris Green  writes:
> >Therein lies the problem, the incoming byte stream *isn't* ASCII, it's
> >an E-Mail message which may, for example, have UTF-8 or other encoded
> >characters in it.  Hopefully it will have an encoding given in the
> >header but that's only if the sender is 'well behaved', one needs to
> >be able to handle almost anything and it must be done without 'manual'
> >interaction.
> 
>   I would make a difference between "scoring" and "transport":
> 
>   To transfer a message into an mbox it can be transferred as it is.
>   Just the bytes from the POP3 server. Let mutt deal with them.
> 
That's what I do at present in Python 2, the problem is that Python 3
complains when I use the standard library to put the message into the
mbox.

I want to transport the message into my mbox and Python 3 won't do it
without knowing how it's encoded whereas Python 2 just stuffed it in
there 'as is'.

I want Python 3's mailbox class to juyst put what I tell it (even if
mis-formatted or mis-encoded) into the mbox.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Richard Damon  wrote:
> On 8/28/20 7:50 AM, Karsten Hilbert wrote:
> >>> No interpreation requires, since parsing failed. Then you can start
> >>> dealing with these exceptions. _Do not_ write unparsable messages into
> >>> an mbox!
> >>>
> >> Maybe I shouldn't but Python 2 has been managing to do so for several
> >> years without any issues.
> > I am inclined to congratulate you on that sheer amount of luck. I don't
> > believe there were no issues because everything worked just right under
> > py2 but rather because py2 cared less than py3 does now.
> >
> >> Are we saying that Python 3 really can't be made to handle things
> >> 'tolerantly' like Python 2 used to?
> > It sure should be possible but it will require *explicit* en/decode()s in
> > more places than before because AFAICT there's less impliciteness as to
> > which encoding to apply (regardless of whether it applies).
> >
> > Karsten
> >
> >
> >
> This might be one of the cases where Python 2's lack handling of string
> vs bytes was an advantage.
> 
> If he was just scanning the message for specific ASCII strings, then not
> getting the full message decoded write is unlikely to have been causing
> problems.
> 
> Python2 handled that sort of case quite easily. Python 3 on the other
> hand, will have issue converting the byte message to a string, since
> there isn't a single encoding that you could use for all of it all the
> time. This being 'fussier' does make sure that the program is handling
> all the text 'properly', and would be helpful if some of the patterns
> being checked for contained 'extended' (non-ASCII) characters.
> 
> One possible solution in Python3 is to decode the byte string using an
> encoding that allows all 256 byte values, so it won't raise any encoding
> errors, just give your possibly non-sense characters for non-ASCII text.
> 
But this will simply get some things quite wrong and produce garbage
won't it?  Whereas Python 2 would simply scramble the odd character.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 10:32 PM Richard Damon  wrote:
>
> This might be one of the cases where Python 2's lack handling of string
> vs bytes was an advantage.
>
> If he was just scanning the message for specific ASCII strings, then not
> getting the full message decoded write is unlikely to have been causing
> problems.
>
> Python2 handled that sort of case quite easily. Python 3 on the other
> hand, will have issue converting the byte message to a string, since
> there isn't a single encoding that you could use for all of it all the
> time. This being 'fussier' does make sure that the program is handling
> all the text 'properly', and would be helpful if some of the patterns
> being checked for contained 'extended' (non-ASCII) characters.
>
> One possible solution in Python3 is to decode the byte string using an
> encoding that allows all 256 byte values, so it won't raise any encoding
> errors, just give your possibly non-sense characters for non-ASCII text.

Why? If you want to work with bytes, work with bytes. There's no
reason to decode in a meaningless way. Python 3 can handle the job of
searching a bytestring for ASCII text just fine.

Also, if you're parsing an email message, you can and should be doing
so with respect to the encoding(s) stipulated in the headers, after
which you will have valid Unicode text.

Please don't spread misinformation like this.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 7:50 AM, Karsten Hilbert wrote:
>>> No interpreation requires, since parsing failed. Then you can start
>>> dealing with these exceptions. _Do not_ write unparsable messages into
>>> an mbox!
>>>
>> Maybe I shouldn't but Python 2 has been managing to do so for several
>> years without any issues.
> I am inclined to congratulate you on that sheer amount of luck. I don't
> believe there were no issues because everything worked just right under
> py2 but rather because py2 cared less than py3 does now.
>
>> Are we saying that Python 3 really can't be made to handle things
>> 'tolerantly' like Python 2 used to?
> It sure should be possible but it will require *explicit* en/decode()s in
> more places than before because AFAICT there's less impliciteness as to
> which encoding to apply (regardless of whether it applies).
>
> Karsten
>
>
>
This might be one of the cases where Python 2's lack handling of string
vs bytes was an advantage.

If he was just scanning the message for specific ASCII strings, then not
getting the full message decoded write is unlikely to have been causing
problems.

Python2 handled that sort of case quite easily. Python 3 on the other
hand, will have issue converting the byte message to a string, since
there isn't a single encoding that you could use for all of it all the
time. This being 'fussier' does make sure that the program is handling
all the text 'properly', and would be helpful if some of the patterns
being checked for contained 'extended' (non-ASCII) characters.

One possible solution in Python3 is to decode the byte string using an
encoding that allows all 256 byte values, so it won't raise any encoding
errors, just give your possibly non-sense characters for non-ASCII text.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 7:50 AM, Karsten Hilbert wrote:
>>> No interpreation requires, since parsing failed. Then you can start
>>> dealing with these exceptions. _Do not_ write unparsable messages into
>>> an mbox!
>>>
>> Maybe I shouldn't but Python 2 has been managing to do so for several
>> years without any issues.
> I am inclined to congratulate you on that sheer amount of luck. I don't
> believe there were no issues because everything worked just right under
> py2 but rather because py2 cared less than py3 does now.
>
>> Are we saying that Python 3 really can't be made to handle things
>> 'tolerantly' like Python 2 used to?
> It sure should be possible but it will require *explicit* en/decode()s in
> more places than before because AFAICT there's less impliciteness as to
> which encoding to apply (regardless of whether it applies).
>
> Karsten
>
>
>

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41652] An Advice on Turning Ellipsis into Keyword

2020-08-28 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

I'm closing this as not being worth the costs of adding new keywords. You're 
welcome to propose it on the python-ideas list (a more appropriate place to 
propose and suss out the details of significant language changes), but you'll 
need to formulate a much stronger reason for making this change.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35228] Index search in CHM help crashes viewer

2020-08-28 Thread Ma Lin


Ma Lin  added the comment:

> when I delete the file %APPDATA%\Microsoft\HTML Help\hh.dat,
> the problem seems to go away.

It doesn't work for me.
Moreover, `Binary Index=Yes` no longer works on my PC.

A few days ago, I installed a clean Windows 10 2004, then CHM's index cannot be 
used.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36207] robotsparser deny all with some rules

2020-08-28 Thread calamina


calamina  added the comment:

I have a problem with my robot.txt on https://www.sondage-remunere.com/

--
nosy: +calamina

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41654] Segfault when raising MemoryError

2020-08-28 Thread STINNER Victor


STINNER Victor  added the comment:

Aha, interesting bug report. I attached a simplified reproducer.

Output with a Python built in debug mode:
---
Objects/frameobject.c:590: _Py_NegativeRefcount: Assertion failed: object has 
negative ref count

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: initialized

Current thread 0x7efd7a2d0740 (most recent call first):
  File "/home/vstinner/bug.py", line 29 in 
Abandon (core dumped)
---

--
nosy: +vstinner
Added file: https://bugs.python.org/file49431/bug.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> > No interpreation requires, since parsing failed. Then you can start
> > dealing with these exceptions. _Do not_ write unparsable messages into
> > an mbox!
> >
> Maybe I shouldn't but Python 2 has been managing to do so for several
> years without any issues.

I am inclined to congratulate you on that sheer amount of luck. I don't
believe there were no issues because everything worked just right under
py2 but rather because py2 cared less than py3 does now.

> Are we saying that Python 3 really can't be made to handle things
> 'tolerantly' like Python 2 used to?

It sure should be possible but it will require *explicit* en/decode()s in
more places than before because AFAICT there's less impliciteness as to
which encoding to apply (regardless of whether it applies).

Karsten



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do I place a preset into the text box?

2020-08-28 Thread Cousin Stanley
Steve wrote:

> The following program compiles but does not quite do what I would like it to
> do. Line 19 is the preset information but I do not seem to be able to get it
> into the form by code.  My purpose is to let the user make changes without
> having to re-enter the entire code.
> 

You might consider moving the entry  get()  function
into the  Submit()  call back 

def Submit() :

label.configure( text = 'The new code is : ' + NewCode.get() )

x = ( NewCode.get() )

print( "\n  The new code entered is :  " + x )



The following  insert  function will show the OldCode
in the  entry  box 
 
OldCode = ( "1234-abcd" )

# 

CodeEntered = ttk.Entry( window , width = 15 , textvariable = NewCode )

CodeEntered.grid( column = 2 , row = 3 , pady = 10 )

CodeEntered.insert( 0 , OldCode )


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do I place a preset into the text box?

2020-08-28 Thread Colin McPhail via Python-list
Hi Steve,

> On 28 Aug 2020, at 11:03, Steve  wrote:
> 
> 
> The following program compiles but does not quite do what I would like it to
> do. Line 19 is the preset information but I do not seem to be able to get it
> into the form by code.  My purpose is to let the user make changes without
> having to re-enter the entire code.

I'm no Tk expert but does the following do what you want? (Strictly speaking, 
the parentheses in ("1234-abcd") are not wrong just unnecessary.)

#===
import tkinter as tk
from tkinter import ttk
import sys

window = tk.Tk()
window.title("Python Tkinter Text Box")
window.minsize(600,400)

def Submit():
   label.configure(text= 'The new code is: ' + NewCode.get())

def ClickExit():
   #This exit closes the program but the form remains and is still active.
   # I want only to close the form.
   print("Exiting")
   #sys.exit()
   window.destroy()

#OldCode = ("1234-abcd")
OldCode = "1234-abcd"

label = ttk.Label(window, text = "Enter the new code")
label.grid(column = 1, row = 1)

#NewCode = tk.StringVar()
NewCode = tk.StringVar(value=OldCode)

CodeEntered = ttk.Entry(window, width = 15, textvariable = NewCode)
CodeEntered.grid(column = 2, row = 3)

button = ttk.Button(window, text = "Submit", command = Submit)
button.grid(column= 2, row = 5)

button = ttk.Button(window, text = "Quit", command = ClickExit)
button.grid(column= 2, row = 7)

window.mainloop()

x = (NewCode.get())
print("The new code entered is: " + x)

#=

Regards,
Colin

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Cameron Simpson  wrote:
> On 28Aug2020 08:56, Chris Green  wrote:
> >Stefan Ram  wrote:
> >> Chris Angelico  writes:
> >> >But this is a really good job for a list comprehension:
> >> >sss = [str(word) for word in bbb]
> >>
> >>   Are you all sure that "str" is really what you all want?
> >>
> >Not absolutely, you no doubt have been following other threads related
> >to this one.  :-)
> 
> It is almost certainly not what you want. You want some flavour of 
> bytes.decode. If the BytesParser doesn't cope, you may need to parse the 
> headers as some kind of text (eg ISO8859-1) until you find a 
> content-transfer-encoding header (which still applies only to the body, 
> not the headers).
> 
> >> |>>> b = b"b"
> >> |>>> str( b )
> >> |"b'b'"
> >>
> >>   Maybe try to /decode/ the bytes?
> >>
> >> |>>> b.decode( "ASCII" )
> >> |'b'
> >>
> >>
> >Therein lies the problem, the incoming byte stream *isn't* ASCII, it's
> >an E-Mail message which may, for example, have UTF-8 or other encoded
> >characters in it.  Hopefully it will have an encoding given in the
> >header but that's only if the sender is 'well behaved', one needs to
> >be able to handle almost anything and it must be done without 'manual'
> >interaction.
> 
> POP3 is presumably handing you bytes containing a message. If the Python 
> email.BytesParser doesn't handle it, stash the raw bytes _elsewhere_ in 
> a distinct file in some directory.
> 
> with open('evil_msg_bytes', 'wb') as f:
> for bs in bbb:
> f.write(bs)
> 
> No interpreation requires, since parsing failed. Then you can start 
> dealing with these exceptions. _Do not_ write unparsable messages into 
> an mbox!
> 
Maybe I shouldn't but Python 2 has been managing to do so for several
years without any issues.  I know I *could* put the exceptions in a
bucket somewhere and deal with them separately but I'd really rather
not.

At prsent (with the Python 2 code still installed) it all 'just works'
and the absolute worst corruption I ever see in an E-Mail is things
like accented characters missing altogether or £ signs coming out as a
funny looking string.  Either of these don't really make the message
unintelligible.

Are we saying that Python 3 really can't be made to handle things
'tolerantly' like Python 2 used to?

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41654] Segfault when raising MemoryError

2020-08-28 Thread Oleg Hoefling


Oleg Hoefling  added the comment:

If this is of any help, I've set up an example repository containing the 
snippet: https://github.com/hoefling/bpo-issue-41654

Here are the results of running the snippet in Travis with Python 3.{5-10} and 
Pypy 3.6: https://travis-ci.com/github/hoefling/bpo-issue-41654

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41651] Pip: Wrong Showing of Progressbar when Downloading Modules

2020-08-28 Thread Henk-Jaap Wagenaar


Henk-Jaap Wagenaar  added the comment:

Thanks for the report, that does look like unfriendly UX.

pip is maintained separately and then vendored (included/packaged in). Could 
you please file an issue here instead: https://github.com/pypa/pip/issues (I 
would do so myself, but as I do not develop on Windows might not be best placed 
to provide feedback).

--
nosy: +cryvate

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41654] Segfault when raising MemoryError

2020-08-28 Thread Oleg Hoefling


New submission from Oleg Hoefling :

First of all, I guess this is a somewhat obscure error that is unlikely to 
occur in a usual context, nevertheless IMO worth reporting. We observed this 
when unit-testing custom exception reporting mechanism, raising different 
exceptions in different contexts and then analyzing whether they are processed 
correctly.

This is a somewhat dull example I managed to extract from our tests:


from pathlib import Path
from unittest.mock import patch


class TestException(MemoryError):
pass


class report_ctx:
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, tb):
report(exc_value)


class raises:
def __init__(self, ex):
self.ex = ex
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, tb):
return issubclass(exc_type, self.ex)


def report(ex):
pass


def error():
raise MemoryError


modname = Path(__file__).stem

for _ in range(10):
with patch(f"{modname}.report"):
with raises(MemoryError), report_ctx():
raise MemoryError

with raises(TestException):
raise TestException

with raises(MemoryError):
error()

that yields:

Fatal Python error: Segmentation fault

Current thread 0x7fcf0833b740 (most recent call first):
  File 
"/home/oleg.hoefling/projects/private/python-memoryerror-segfault/main.py", 
line 38 in 
  File "", line 228 in _call_with_frames_removed
  File "", line 790 in exec_module
  File "", line 680 in _load_unlocked
  File "", line 986 in _find_and_load_unlocked
  File "", line 1007 in _find_and_load
  File "/usr/lib64/python3.9/unittest/mock.py", line 1236 in _importer
  File "/usr/lib64/python3.9/unittest/mock.py", line 1564 in 
  File "/usr/lib64/python3.9/unittest/mock.py", line 1389 in __enter__
  File 
"/home/oleg.hoefling/projects/private/python-memoryerror-segfault/main.py", 
line 36 in 

--
components: Interpreter Core
messages: 376028
nosy: hoefling
priority: normal
severity: normal
status: open
title: Segfault when raising MemoryError
type: crash
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 08:56, Chris Green  wrote:
>Stefan Ram  wrote:
>> Chris Angelico  writes:
>> >But this is a really good job for a list comprehension:
>> >sss = [str(word) for word in bbb]
>>
>>   Are you all sure that "str" is really what you all want?
>>
>Not absolutely, you no doubt have been following other threads related
>to this one.  :-)

It is almost certainly not what you want. You want some flavour of 
bytes.decode. If the BytesParser doesn't cope, you may need to parse the 
headers as some kind of text (eg ISO8859-1) until you find a 
content-transfer-encoding header (which still applies only to the body, 
not the headers).

>> |>>> b = b"b"
>> |>>> str( b )
>> |"b'b'"
>>
>>   Maybe try to /decode/ the bytes?
>>
>> |>>> b.decode( "ASCII" )
>> |'b'
>>
>>
>Therein lies the problem, the incoming byte stream *isn't* ASCII, it's
>an E-Mail message which may, for example, have UTF-8 or other encoded
>characters in it.  Hopefully it will have an encoding given in the
>header but that's only if the sender is 'well behaved', one needs to
>be able to handle almost anything and it must be done without 'manual'
>interaction.

POP3 is presumably handing you bytes containing a message. If the Python 
email.BytesParser doesn't handle it, stash the raw bytes _elsewhere_ in 
a distinct file in some directory.

with open('evil_msg_bytes', 'wb') as f:
for bs in bbb:
f.write(bs)

No interpreation requires, since parsing failed. Then you can start 
dealing with these exceptions. _Do not_ write unparsable messages into 
an mbox!

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15443] datetime module has no support for nanoseconds

2020-08-28 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 20.0 -> 21.0
pull_requests: +21096
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/21987

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



How do I place a preset into the text box?

2020-08-28 Thread Steve


The following program compiles but does not quite do what I would like it to
do. Line 19 is the preset information but I do not seem to be able to get it
into the form by code.  My purpose is to let the user make changes without
having to re-enter the entire code.

Suggestions welcome.
Steve

#===
import tkinter as tk
from tkinter import ttk
import sys

window = tk.Tk()
window.title("Python Tkinter Text Box")
window.minsize(600,400)

def Submit():
label.configure(text= 'The new code is: ' + NewCode.get())

def ClickExit():
#This exit closes the program but the form remains and is still active.
# I want only to close the form.
print("Exiting")
sys.exit()

OldCode = ("1234-abcd")

label = ttk.Label(window, text = "Enter the new code")
label.grid(column = 1, row = 1)

NewCode = tk.StringVar()
CodeEntered = ttk.Entry(window, width = 15, textvariable = NewCode)
CodeEntered.grid(column = 2, row = 3)

button = ttk.Button(window, text = "Submit", command = Submit)
button.grid(column= 2, row = 5)

button = ttk.Button(window, text = "Quit", command = ClickExit)
button.grid(column= 2, row = 7)

window.mainloop()

x = (NewCode.get())
print("The new code entered is: " + x)
  
#=



Footnote: 
Mars is the only known planet in our solar system solely inhabited by
functioning robots.


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41642] Buildbot: workers detached every minute and "no space left on device" issue

2020-08-28 Thread STINNER Victor


STINNER Victor  added the comment:

On the server side, it seems like the "edelsohn-rhel8-z" worker is detached 
because its TCP connection is closed, only 87 seconds after the worker was 
attached. I added some debug traces:

2020-08-28 09:44:02+ [Broker,2,10.132.169.156] worker 'edelsohn-rhel8-z' 
attaching from IPv4Address(type='TCP', host='10.132.169.156', port=56234)
2020-08-28 09:44:02+ [Broker,2,10.132.169.156] Got workerinfo from 
'edelsohn-rhel8-z'
(...)
2020-08-28 09:45:29+ [Broker,2,10.132.169.156] @ detached: worker=
2020-08-28 09:45:29+ [Broker,2,10.132.169.156] @ detached: TB:   File 
"", line 1, in 
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/scripts/twistd.py", 
line 31, in run
app.run(runApp, ServerOptions)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/application/app.py", 
line 674, in run
runApp(config)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/scripts/twistd.py", 
line 25, in runApp
runner.run()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/application/app.py", 
line 385, in run
self.postApplication()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/scripts/_twistd_unix.py",
 line 268, in postApplication
self.startReactor(None, self.oldstdout, self.oldstderr)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/application/app.py", 
line 398, in startReactor
runReactorWithLogging(
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/application/app.py", 
line 312, in runReactorWithLogging
reactor.run()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/base.py", line 
1283, in run
self.mainLoop()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/base.py", line 
1295, in mainLoop
self.doIteration(t)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/epollreactor.py",
 line 235, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/python/log.py", line 
103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/python/log.py", line 
86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/python/context.py", 
line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/python/context.py", 
line 85, in callWithContext
return func(*args,**kw)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/posixbase.py", 
line 627, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/posixbase.py", 
line 252, in _disconnectSelectable
selectable.readConnectionLost(f)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/tcp.py", line 
307, in readConnectionLost
self.connectionLost(reason)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/tcp.py", line 
327, in connectionLost
protocol.connectionLost(reason)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/spread/pb.py", line 
717, in connectionLost
notifier()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/spread/pb.py", line 
1572, in maybeLogout
fn()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/buildbot/pbmanager.py", line 
190, in 
return (pb.IPerspective, persp, lambda: persp.detached(mind))
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/buildbot/worker/protocols/pb.py",
 line 155, in detached
import traceback, io; out = io.StringIO(); 
traceback.print_stack(file=out); tb = out.getvalue()

It doesn't say if the client closed the connection on purpose, or if the load 
balancer closed an inactive connection.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41642] Buildbot: workers detached every minute and "no space left on device" issue

2020-08-28 Thread STINNER Victor


STINNER Victor  added the comment:

There are multiple errors in the buildbot server logs. I'm not sure if it's 
related or not.

2020-08-28 09:16:25+ [-] while invoking >
Traceback (most recent call last):
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 1418, in _inlineCallbacks
result = g.send(result)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/buildbot/reporters/http.py", 
line 80, in getMoreInfoAndSend
yield self.send(build)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 1613, in unwindGenerator
return _cancellableInlineCallbacks(gen)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 1529, in _cancellableInlineCallbacks
_inlineCallbacks(None, g, status)
---  ---
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/buildbot/reporters/http.py", 
line 80, in getMoreInfoAndSend
yield self.send(build)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 1418, in _inlineCallbacks
result = g.send(result)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/buildbot/reporters/github.py", 
line 133, in send
m = re.search(r"refs/pull/([0-9]*)/merge", branch)
  File "/usr/lib/python3.8/re.py", line 201, in search
return _compile(pattern, flags).search(string)
builtins.TypeError: expected string or bytes-like object


Error when stopping the server. It seems like this one is just that a client 
tries to reconnect whereas the server is down:

2020-08-28 09:30:43+ [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] 
BuildMaster is stopped
2020-08-28 09:30:43+ [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] 
invalid login from unknown user 'ware-win81-release'
2020-08-28 09:30:43+ [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] 
Peer will receive following PB traceback:
2020-08-28 09:30:43+ [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] 
Unhandled Error
Traceback (most recent call last):
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 460, in callback
self._startRunCallbacks(result)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 568, in _startRunCallbacks
self._runCallbacks()
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 654, in _runCallbacks
current.result = callback(current.result, *args, **kw)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 1475, in gotResult
_inlineCallbacks(r, g, status)
---  ---
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/twisted/internet/defer.py", 
line 1418, in _inlineCallbacks
result = g.send(result)
  File 
"/srv/buildbot/venv/lib/python3.8/site-packages/buildbot/pbmanager.py", line 
217, in requestAvatarId
eventually(self.master.initLock.release)
builtins.AttributeError: 'NoneType' object has no attribute 'initLock'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22577] local variable changes lost after pdb jump command

2020-08-28 Thread Irit Katriel


Irit Katriel  added the comment:

This is now resolved, on Python 3.10 I get:

>python -m pdb tmp1.py
Running Release|Win32 interpreter...
> c:\users\user\src\cpython\tmp1.py(1)()
-> def foo(x):
(Pdb) jump 4
> c:\users\user\src\cpython\tmp1.py(4)()
-> lineno = 4
(Pdb) q

C:\Users\User\src\cpython>python -m pdb tmp1.py
Running Release|Win32 interpreter...
> c:\users\user\src\cpython\tmp1.py(1)()
-> def foo(x):
(Pdb) x=123
(Pdb) jump 4
> c:\users\user\src\cpython\tmp1.py(4)()
-> lineno = 4
(Pdb) x
123
(Pdb)


I believe this ticket can be closed.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41649] Can't pass Path like objects to subprocess api's on Windows.

2020-08-28 Thread Jani Mikkonen


Jani Mikkonen  added the comment:

@xtreak

I went thru the comments of the report you linked. It definitely looks like the 
discussion was related  but it didnt really fix the issue here.

https://bugs.python.org/issue31961#msg311775 without trying out, that comment 
actually touches the underlying issue, on windows, list2cmdline throws that 
typeerror because iterated argument list (output_directory in my example) is 
WindowsPath and thus not iterable and and testing the arg with "in" operator 
fails ..

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41642] Buildbot: workers detached every minute and "no space left on device" issue

2020-08-28 Thread STINNER Victor


STINNER Victor  added the comment:

I added keepalive_interval=60 parameter to Worker() in the server configuration:
https://github.com/python/buildmaster-config/commit/2d28a4cfe77a3e206028613524a1e938801a1655

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41642] Buildbot: workers detached every minute and "no space left on device" issue

2020-08-28 Thread STINNER Victor


STINNER Victor  added the comment:

> The buildbot server migrated to a new machine and is now behind a load 
> balancer. tcp/80 (buildbot web page, HTTP) and tcp/9020 (used by buildbot 
> workers) are both behind the load balancer.
> (...)
> Buildbot workers have a TCP keepalive option of 1 hour (3600 seconds) by 
> default (...)

Ernest confirmed that there are edge load balancers for the PSF infra in 
DigitalOcean. He updated the load balancers to offer a full 24 hour timeout on 
buildbot TCP connections. (Yesterday around 17:30 UTC.)

It seems like it doesn't fix the issue. Example in server logs:

(...)
2020-08-28 08:21:55+ [Broker,50831,10.132.169.157] 
Worker.detached(koobs-freebsd-564d)
2020-08-28 08:23:25+ [Broker,50856,10.132.169.157] 
Worker.detached(koobs-freebsd-564d)
2020-08-28 08:24:55+ [Broker,50881,10.132.169.157] 
Worker.detached(koobs-freebsd-564d)
2020-08-28 08:26:26+ [Broker,50906,10.132.169.157] 
Worker.detached(koobs-freebsd-564d)
2020-08-28 08:27:56+ [Broker,50931,10.132.169.156] 
Worker.detached(koobs-freebsd-564d)
(...)

--
title: RHEL and fedora buildbots fail due to disk space error -> Buildbot: 
workers detached every minute and "no space left on device" issue

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Cameron Simpson  wrote:
> On 27Aug2020 23:54, Marco Sulla  wrote:
> >Are you sure you want `str()`?
> >
>  str(b'aaa')
> >"b'aaa'"
> >
> >Probably you want:
> >
> >map(lambda x: x.decode(), bbb)
> 
> _And_ you need to know the encoding of the text in the bytes. The above 
> _assumes_ UTF-8 because that is the default for bytes.decode, and if 
> that is _not_ what is in the bytes objects you will get mojibake.
> 
> Because a lot of stuff is "mostly ASCII", this is the kind of bug which 
> can lurk until much later when you have less usual data.
> 
If there's an encoding given in the header of the incoming E-Mail then
one (hopefully) knows what the encoding is.  However you have to be
able to handle the more general case where either the encoding isn't
given or it's wrong. In the real world E-Mail survives having an
incorrect encoding in the header, what you see is either missing or
garbled characters with the remainder being OK.  Garbling the whole
lot isn't a good approach.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do I do this in Python 3 (string.join())?

2020-08-28 Thread Chris Green
Cameron Simpson  wrote:
[snip]
> 
> >The POP3 processing is solely to collect E-Mail that ends up in the
> >'catchall' mailbox on my hosting provider.  It empties the POP3
> >catchall mailbox, checks for anything that *might* be for me or other
> >family members then just deletes the rest.
> 
> Very strong email policy, that one. Personally I fear data loss, and 
> process everything; anything which doesn't match a rule lands in my 
> "UNKNOWN" mail folder for manual consideration when I'm bored. It is 
> largely spam, but sometimes has a message wanting a new filing rule.
> 
It's not *that* strong, the catchall is for *anything* that is
addressed to either of the two domains hosted there.  I.e. mail for
xhghj...@isbd.net will arrive in the catchall mailbox.  So I just
search the To: address for anything that might be a typo for one of
our names or anything else that might be of interest.  I have an
associated configuration file that specifies the patterns to look for
so I can change things on the fly as it were.

One of the scripts that I'm having trouble converting to Python 3 is
the one that does this catchall management.


> >> >E.g. in this case the only (well the only ready made) way to get a
> >> >POP3 message is using poplib and this just gives you a list of lines
> >> >made up of "bytes as text" :-
> >> >
> >> >popmsg = pop3.retr(i+1)
> >>
> >> Ok, so you have bytes? You need to know.
> >>
> >The documentation says (and it's exactly the same for Python 2 and
> >Python 3):-
> >
> >POP3.retr(which)
> >Retrieve whole message number which, and set its seen flag. Result
> >is in form (response, ['line', ...], octets).
> >
> >Which isn't amazingly explicit unless 'line' implies a string.
> 
> Aye. But "print(repr(a_pop_line))" will tell you. Almost certainly a 
> string-of-bytes, so I would expect bytes. The docs are probably 
> unchanged during the Python2->3 move.
> 
Yes, I added some print statments to my catchall script to find out
and, yes, the returned value is a list of 'byte strings'.  It's a pity
there isn't a less ambiguous name for 'string-of-bytes'! :-)


> >> >I join the lines to feed them into mailbox.mbox() to create a mbox I
> >> >can analyse and also a message which can be sent using SMTP.
> 
> Ah. I like Maildirs for analysis; every message has its own file, which 
> makes adding and removing messages easy, and avoids contention with 
> other things using the Maildir.
> 
> My mailfiler can process Maildirs (scan, add, remove) and add to 
> Maildirs and mboxes.
> 
I've switched to maildir several times in the past and have always
switched back because they have so many 'standards'.  I use mutt as my
MUA and that does handle maildir as well as anything but still doesn't
do it for me.  :-)

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Chris Angelico  wrote:
> On Fri, Aug 28, 2020 at 6:36 AM Chris Green  wrote:
> >
> > This sounds quite an easy thing to do but I can't find how to do it
> > elegantly.
> >
> > I have a list of bytes class objects (i.e. a list containing sequences
> > of bytes, which are basically text) and I want to convert it to a list
> > of string objects.
> >
> > One of the difficulties of finding out how to do this is that 'list of
> > bytes' tends to mean a bytes object with a sequence of bytes in it
> > which is *not* what I'm after converting. :-)
> >
> > Obviously I can do:-
> >
> > bbb = [b'aaa', b'bbb', b'ccc']
> > sss = []
> > for i in range(0, 2):
> > sss.append(str(bbb[i])
> >
> > but that does seem a bit clumsy.  Is there a better way?
> >
> 
> Firstly, you shouldn't iterate over the range, but over the items themselves:
> 
> for word in bbb:
> 
Yes, of course, it was just a 'quick and dirty' to make the point.


> But this is a really good job for a list comprehension:
> 
> sss = [str(word) for word in bbb]
> 
That seems the way to do it, thanks.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Stefan Ram  wrote:
> Chris Angelico  writes:
> >But this is a really good job for a list comprehension:
> >sss = [str(word) for word in bbb]
> 
>   Are you all sure that "str" is really what you all want?
> 
Not absolutely, you no doubt have been following other threads related
to this one.  :-)


> |>>> b = b"b"
> |>>> str( b )
> |"b'b'"
> 
>   Maybe try to /decode/ the bytes?
> 
> |>>> b.decode( "ASCII" )
> |'b'
> 
> 
Therein lies the problem, the incoming byte stream *isn't* ASCII, it's
an E-Mail message which may, for example, have UTF-8 or other encoded
characters in it.  Hopefully it will have an encoding given in the
header but that's only if the sender is 'well behaved', one needs to
be able to handle almost anything and it must be done without 'manual'
interaction.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> >Are you sure you want `str()`?
> >
>  str(b'aaa')
> >"b'aaa'"
> >
> >Probably you want:
> >
> >map(lambda x: x.decode(), bbb)
>
> _And_ you need to know the encoding of the text in the bytes. The above
> _assumes_ UTF-8 because that is the default for bytes.decode, and if
> that is _not_ what is in the bytes objects you will get mojibake.
>
> Because a lot of stuff is "mostly ASCII", this is the kind of bug which
> can lurk until much later when you have less usual data.

As I said, crawl the delivery chain looking for where things
come from (and what they are).

Karsten
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41652] An Advice on Turning Ellipsis into Keyword

2020-08-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is Ellipsis class in the ast module. Although it is deprecated now. But I 
there may be Ellipsis names also in third-party libraries. Making Ellipsis a 
keyword would break them.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41652] An Advice on Turning Ellipsis into Keyword

2020-08-28 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

You can do the same thing to replace int, float, dict, len, and all the other 
built-in classes and functions. Why is Ellipsis so special that it needs 
protection, especially when, as you note, ... is an available unoverrideable 
way to refer to it? Making new keywords is a high bar (because it can break 
existing code). What justifies this one beyond "don't want folks to mess with a 
barely used name"?

--
nosy: +josh.r

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com