Re: Video file to subtitles file

2020-08-30 Thread Christian Gollwitzer

Am 30.08.20 um 21:43 schrieb MRAB:

On 2020-08-30 18:10, Christian Gollwitzer wrote:

Well, with enough effort it is possible to build a system that is more
useful than "entertaining". Google did that, English youtube videos can
be annotated with subtitles from speech recognition. For example, try
this video:
https://www.youtube.com/watch?v=lYVLpC_8SQE



There's not much background noise there; it takes place in a quiet room.


 It becomes a bit worse once the background music sets in, but still is 
usable. Feel free to try any other video. I think, it works with any 
video in English.


I think that for "Hollywood"-style movies you will always have a crisp 
sound of the speech. They want the viewers to listen effortlessly - 
background music is typical, "true" noise is rare.


Maybe try with this video:
https://www.youtube.com/watch?v=nHn4XpKA6vM

As soon as they are up in the air you have the engine sound overlaying 
the speech, and still the transcription is quite good. It sometimes 
mistakes the flapping of the engine as "applause" and misses a word or a 
sentence, but still very good.


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


Re: Symlinks already present

2020-08-30 Thread Chris Angelico
On Mon, Aug 31, 2020 at 1:17 PM Cameron Simpson  wrote:
> Each "source" symlink has its own inode. But if you os.stat() the
> symlink it follows the symlink and you get the inode for the "target"
> directory - two symlinks which point at the same directory will return the 
> same
> inode and thus (st_dev,st_ino) in that stat result.
>
> That can be used for comparison, and you don't need to readlink or
> anything like that - let the OS do it all for you during the os.stat()
> call.

Note that this is only the case if os.stat is called with
follow_symlinks=True, which is the default, but isn't the only way to
do things. And if you get stat results while you're iterating over a
directory, you don't follow symlinks.

> >[old-Unix-guy story: Way back when, SunOS used to allow you (if root)
> >to create a hard link to a directory.  It's not something you did a
> >second time.]
>
> It's a well defined operation. There are some policy choices an OS can
> make about some of the side effects (how does pwd work? how you got
> there? or some underlying "real" path - this spills over into "what does
> ".." mean?), etc. But having made those choices, the idea is just fine.

Is it well defined? Because of the ".." issue, it's not going to be as
symmetric as hardlinking files is. You can move a file by hardlinking
it and then unlinking the original name. If you do that with a
directory, at what point do you update its parent pointer? What
happens if you create TWO more hardlinks, and then unlink the original
name? Can you even *have* a single concept of a "real path" without it
basically just being symlinks in disguise?

BTW, the pwd issue actually isn't an issue, since it really *will* be
"how you got there". You can see that with modern systems if you have
symlinks in the path, or rename a directory:

rosuav@sikorsky:~/tmp$ mkdir -p a/b/c/d/e
rosuav@sikorsky:~/tmp$ cd a/b/c/d/e
rosuav@sikorsky:~/tmp/a/b/c/d/e$ mv ~/tmp/a/{b,q}
rosuav@sikorsky:~/tmp/a/b/c/d/e$ pwd
/home/rosuav/tmp/a/b/c/d/e
rosuav@sikorsky:~/tmp/a/b/c/d/e$ cd `pwd`
bash: cd: /home/rosuav/tmp/a/b/c/d/e: No such file or directory
rosuav@sikorsky:~/tmp/a/b/c/d/e$ ls -al
total 8
drwxr-xr-x 2 rosuav rosuav 4096 Aug 31 14:17 .
drwxr-xr-x 3 rosuav rosuav 4096 Aug 31 14:17 ..
rosuav@sikorsky:~/tmp/a/b/c/d/e$ cd ..
rosuav@sikorsky:~/tmp/a/q/c/d$ pwd
/home/rosuav/tmp/a/q/c/d
rosuav@sikorsky:~/tmp/a/q/c/d$

As soon as I try to go to the parent, it has to figure out what the
real path to that parent is. Otherwise, it's just the path that I
typed to get there - even though that might no longer be correct.
(There have been times, for instance, when I'm in a "dead" directory
and have to cd `pwd` to get back to the "real" directory with the same
name.)

The parent directory is crucially important here.

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


[issue41670] ceval traces code differently based with USE_COMPUTED_GOTOS

2020-08-30 Thread Ammar Askar


Ammar Askar  added the comment:

So I think this is a weird edge case with a set of opcode predictions (GET_ITER 
-> FOR_ITER -> POP_BLOCK) going outside of a line boundary.

The disassembly of the reproducer above is:

  4   0 SETUP_FINALLY   16 (to 18)

  5   2 LOAD_CONST   1 (())
  4 GET_ITER
>>6 FOR_ITER 4 (to 12)
  8 STORE_FAST   0 (i)
 10 JUMP_ABSOLUTE6

  6 >>   12 POP_BLOCK
 14 LOAD_CONST   2 (1)
 16 RETURN_VALUE

When computed gotos are disabled and there is a tracing function, instructions 
0, 2, 4, 14 and 16 hit the `fast_next_opcode` label and have a chance to be 
traced as line hits. Note that `maybe_call_line_trace` will only cause a line 
hit if the instruction that starts a line (POP_BLOCK in this case) is being 
executed.

When computed gotos are enabled, DISPATCH is a no-op and there is a special 
case for when tracing is enabled that causes every opcode to go through 
`fast_next_opcode`: 
https://github.com/python/cpython/blob/c3a651ad2544d7d1be389b63e9a4a58a92a31623/Python/ceval.c#L1054-L1059

When computed gotos are not enabled, there is no similar check for PREDICT (and 
might be too costly to add) causing this issue: 
https://github.com/python/cpython/blob/c3a651ad2544d7d1be389b63e9a4a58a92a31623/Python/ceval.c#L1131-L1141

--
title: Windows and Linux execute the same code differently -> ceval traces code 
differently based with USE_COMPUTED_GOTOS

___
Python tracker 

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



[issue41670] ceval traces code differently with USE_COMPUTED_GOTOS

2020-08-30 Thread Ammar Askar


Change by Ammar Askar :


--
title: ceval traces code differently based with USE_COMPUTED_GOTOS -> ceval 
traces code differently with USE_COMPUTED_GOTOS

___
Python tracker 

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



[issue41670] Windows and Linux execute the same code differently

2020-08-30 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +Mark.Shannon, pablogsal

___
Python tracker 

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



Re: Symlinks already present

2020-08-30 Thread Cameron Simpson
On 27Jul2020 20:20, Termoregolato  wrote:
>Il 26/07/20 20:39, Dennis Lee Bieber ha scritto:
>>Since symbolic links are essentially just short files containing the
>>path to the eventual target file/directory, with an OS flag that the file
>>is a link
>
>Yes, I use them massively to give to a lot of directories a kind of 
>order, depending on their contents. It's simple to see if link is 
>broken, but not if they're duplicate

Hmm. If you're scanning them all, you can at least cache the (dev,ino) 
of the link target. So broken is stat-failed. Duplicate is 
seen-this-(dev,ino)-before. You only need the stat, not to (for example) 
resolve the path the symlink becomes.

You've probably thought of this already of cource.

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


Re: Symlinks already present

2020-08-30 Thread Cameron Simpson
On 27Jul2020 22:19, Grant Edwards  wrote:
>On 2020-07-27, Termoregolato  wrote:
>> Il 26/07/20 22:47, dn ha scritto:
>>> Thus, compare the results of the two calls to detect a difference.
>>
>> I will try also another way, If I don't err symlinks and original
>> directory  have the same inode number (I talk about Linux, where I'm
>> using the application).
>
>You err.  Symlinks are distinct i-nodes which are not the same i-node
>as the destination.  A symlink is basically a file containing a string
>that is read and then used a path to another file.

We need to be careful with terminology (just for clarity).

Each "source" symlink has its own inode. But if you os.stat() the 
symlink it follows the symlink and you get the inode for the "target" 
directory - two symlinks which point at the same directory will return the same 
inode and thus (st_dev,st_ino) in that stat result.

That can be used for comparison, and you don't need to readlink or 
anything like that - let the OS do it all for you during the os.stat() 
call.

>If you create a "hard" link (ln without the '-s') then you end up a single
>i-node that has entries in multiple directories.

Aye.

>[old-Unix-guy story: Way back when, SunOS used to allow you (if root)
>to create a hard link to a directory.  It's not something you did a
>second time.]

It's a well defined operation. There are some policy choices an OS can 
make about some of the side effects (how does pwd work? how you got 
there? or some underlying "real" path - this spills over into "what does 
".." mean?), etc. But having made those choices, the idea is just fine.

As a counter example, many rsync based backup systems have the following 
underlying approach:

- make a new directory tree with every file hardlinked from the previous 
  backup tree

- rsync into the new tree, because rsync unlinks and replaces changed 
  files

By contrast, MacOS Time Machine utilitises hardlinking directories on 
HFS volumes: instead of making a new directory tree full of hardlinks 
you just hardlink the top directory itself if nothing inside it has been 
changed.

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


[issue39349] Add "cancel_futures" parameter to concurrent.futures.Executor.shutdown()

2020-08-30 Thread Kyle Stanley


Kyle Stanley  added the comment:

Good catch, Shantanu. It was not intentional on my part, and it would make 
sense to include *cancel_futures* in the base Executor class as documented. If 
you'd like to submit a PR to add it (attaching it to this issue), I should be 
able to review it within a reasonable period.

--

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-30 Thread Guido van Rossum


Guido van Rossum  added the comment:

Got it.

On Sun, Aug 30, 2020 at 15:28 Terry J. Reedy  wrote:

>
>
> Terry J. Reedy  added the comment:
>
>
>
> sys.argv cannot be set until sys exists.  As I mentioned above, subsequent
> calls before finalization must continue to be no-ops.
>
>
>
> Code that depends on a bug, in this case of sys.argv not existing, is
> always vulnerable.  In this case, I would expect that people who want
> sys.argv to have a particular value would unconditionally set it.  If it
> were conditionally set, the program would likely exit or otherwise fail a
> test.  I intentionally have not suggested backporting a code change.
>
>
>
> --
>
>
>
> ___
>
> Python tracker 
>
> 
>
> ___
>
> --
--Guido (mobile)

--

___
Python tracker 

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



[issue41670] Windows and Linux execute the same code differently

2020-08-30 Thread Ammar Askar


Ammar Askar  added the comment:

minimal reproducer without coverage:


import sys

def f():
try:
for i in []: pass
return 1
except:
return 2

def tracer(frame, event, _):
if event == 'line':
print("executing line {}".format(frame.f_lineno))
return tracer

sys.settrace(tracer)
f()



With computed gotos this results in:

> executing line 4
> executing line 5
> executing line 6

but without:

> executing line 4
> executing line 5

--
nosy: +ammar2

___
Python tracker 

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



[issue41671] inspect.getdoc/.cleandoc doesn't always remove trailing blank lines

2020-08-30 Thread RalfM


New submission from RalfM :

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> def func1():
... """This is func1.
... """
... pass
...
>>> inspect.getdoc(func1)
'This is func1.\n'
>>>
>>> def func2():
... """Line1
...Line2 
...
..."""
...
>>> inspect.getdoc(func2)
'Line1\nLine2 \n\n'

Note: The blank line between "Line2 " and the closing """ contains 11 spaces.

The algorithm given in PEP 257 returns what I would expect, i.e. 
'This is func1.'
and
'Line1\nLine2'
respectively.

Strictly speaking, inspect.cleandoc doesn't claim to implement PEP 257.
However, there is a comment "# Remove any trailing or leading blank lines." in 
the code of inspect.cleandoc, and this is obviously not done.

Looking at the code, the reason seems to be twofold:

1. When removing the indentation, PEP 257 also does a .rstrip() on the lines, 
inspect.cleandoc doesn't.
As a consequence, in inspect.cleandoc trailing lines with many spaces will 
still contain spaces after the indentation has been removed, thus are not empty 
and the "while lines and not lines[-1]" doesn't remove them.
That explains func2 above.

2. If all lines but the first are blank (as in func1 above), indent / margin 
will be sys.maxint / sys.maxsize and no indentation will be removed.
PEP 257 copies dedented lines to a new list. If no indentation needs to be 
removed, nothing but the first line will be copied, and so the trailing lines 
are gone.
inspect.cleandoc dedents lines inplace. If no indentation needs to be removed 
the trailing lines with spaces remain and, as they contain spaces, the "while 
lines and not lines[-1]" doesn't remove them.

There is another difference between PEP 257 and inspect.cleandoc: PEP 257 
removes trailing whitespace on every line, inspect.cleandoc preserves it.
I don't know whether that's intentional.

I see this behaviour in 3.7 and 3.8, and the inspect.cleandoc code is unchanged 
in 3.9.0rc1.

--
components: Library (Lib)
messages: 376136
nosy: RalfM
priority: normal
severity: normal
status: open
title: inspect.getdoc/.cleandoc doesn't always remove trailing blank lines
type: behavior
versions: 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



[issue41670] Windows and Linux execute the same code differently

2020-08-30 Thread Ned Batchelder


New submission from Ned Batchelder :

Coverage.py bug reports https://github.com/nedbat/coveragepy/issues/1022 and 
https://github.com/nedbat/coveragepy/issues/959 demonstrate the same Python 
code, with the same disassembly, executing differently.

In 
https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098,
 Ammar Askar said:

> For any core developer who wants to look into this, based on my preliminary 
> research this seems to be related to opcode prediction and computed GOTOS.
> 
> If you put #define USE_COMPUTED_GOTOS 0 above 
> https://github.com/python/cpython/blob/master/Python/ceval.c#L1033 then this 
> issue is re-creatable on Linux/Mac.
> 
> It seems to be an issue relating to how f_lasti is updated.

--
components: Interpreter Core
keywords: 3.8regression
messages: 376135
nosy: nedbat
priority: normal
severity: normal
status: open
title: Windows and Linux execute the same code differently
type: behavior
versions: 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



[issue41615] sys.argv may be None or an empty list

2020-08-30 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

sys.argv cannot be set until sys exists.  As I mentioned above, subsequent 
calls before finalization must continue to be no-ops.

Code that depends on a bug, in this case of sys.argv not existing, is always 
vulnerable.  In this case, I would expect that people who want sys.argv to have 
a particular value would unconditionally set it.  If it were conditionally set, 
the program would likely exit or otherwise fail a test.  I intentionally have 
not suggested backporting a code change.

--

___
Python tracker 

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



[issue39349] Add "cancel_futures" parameter to concurrent.futures.Executor.shutdown()

2020-08-30 Thread Shantanu


Shantanu  added the comment:

I was working on updating typeshed stubs to reflect this change. It looks like 
the parameter wasn't actually added to the base class 
(https://github.com/python/cpython/blob/c3a651ad2544d7d1be389b63e9a4a58a92a31623/Lib/concurrent/futures/_base.py#L608),
 even though it's documented as having the new parameter 
(https://docs.python.org/3.9/library/concurrent.futures.html#concurrent.futures.Executor.shutdown).

Is this intentional? If not, I'd be happy to submit a PR adding the parameter 
to the base class.

--
nosy: +hauntsaninja

___
Python tracker 

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



Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Stephane Tougard via Python-list
On 2020-08-30, Barry  wrote:
>*  The child process is created with a single thread—the one that
>   called fork().  The entire virtual address space of the parent is
>   replicated in the child, including the states of mutexes,
>   condition variables, and other pthreads objects; the use of
>   pthread_atfork(3) may be helpful for dealing with problems that

Indeed, I have a similar entry on my NetBSD:

 In case of a threaded program, only the thread calling fork() is
 still running in the child processes.

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


[issue28724] Add method send_io, recv_io to the socket module.

2020-08-30 Thread Shantanu


Shantanu  added the comment:

I was looking at adding stubs for these to typeshed. Is it intentional that we 
ignore the flags and address arguments in the implementation?

--
nosy: +hauntsaninja

___
Python tracker 

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



[issue41669] Case mismatch between "include" and "Include"

2020-08-30 Thread Gregory Szorc


New submission from Gregory Szorc :

On Windows, `sysconfig.get_path('include')` returns `Include` (capital I).

However, the actual installation path is `include` (lowercase i).

I believe the reason for the case mismatch is in this code in PC/layout/main.py:

```
if ns.include_dev:

for dest, src in rglob(ns.source / "Include", "**/*.h"):
yield "include/{}".format(dest), src
src = ns.source / "PC" / "pyconfig.h"
yield "include/pyconfig.h", src
```

The case mismatch is relevant for case sensitive filesystems. In my case, I was 
extracting a Windows Python install on Linux and then using the `sysconfig` 
value to locate directories within that install. Due to the case mismatch, 
Linux says `Include` doesn't exist since `sysconfig` points to "include."

Case only renames can be a bit wonky to perform. I would suggest preserving 
what is shipped today and changing `sysconfig` to advertise lowercase 
"include." However, this would create a mismatch between the cpython source 
repo and built distributions. So maybe attempting the case-only rename is 
doable.

Note that Windows will not allow you to have a file/directory varying only in 
case. i.e. you can have both an "include" and "Include." I can't recall if you 
can perform a case-only rename with a single system call (meaning it is atomic) 
or whether you need to go through a temporary directory.

--
components: Windows
messages: 376131
nosy: indygreg, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Case mismatch between "include" and "Include"
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



[issue41668] Expose eventfd for high-performance event notifier in Linux

2020-08-30 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue41668] Expose eventfd for high-performance event notifier in Linux

2020-08-30 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

The eventfd system calls can allow us to implement some Linux-specific high 
performance version of some event notifier abstractions in the standard 
library. 

eventfd() creates an "eventfd object" that can be used as an event wait/notify 
mechanism by user-space applications. The object contains an
unsigned 64-bit integer counter that is maintained by the kernel. This acts as 
a file descriptor that can be used by the usual suspects 
(read/write/poll/close...).

The advantage here is that the kernel maintains the counter and if used in 
conjunction with poll/epoll, it allows for a high-performance and
scallabe event notification system.

--
components: IO, Library (Lib)
messages: 376130
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Expose eventfd for high-performance event notifier in Linux
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



[issue41667] The python PEG generator incorrectly handles empty sequences in gather rules

2020-08-30 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue41667] The python PEG generator incorrectly handles empty sequences in gather rules

2020-08-30 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.

--
messages: 376129
nosy: pablogsal
priority: normal
severity: normal
status: open
title: The python PEG generator incorrectly handles empty sequences in gather 
rules
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



[issue41654] Segfault when raising MemoryError

2020-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The problem is that the deallocator of MemoryError class is not taking into 
account subclasses for the freelist management, but the allocator (tp_new) is.

--

___
Python tracker 

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



[issue39994] pprint handling of dict subclasses that override __repr__

2020-08-30 Thread Eric V. Smith


Change by Eric V. Smith :


--
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



Re: Video file to subtitles file

2020-08-30 Thread MRAB

On 2020-08-30 18:10, Christian Gollwitzer wrote:

Am 30.08.20 um 17:25 schrieb MRAB:

On 2020-08-30 07:23, Muskan Sanghai wrote:

On Sunday, August 30, 2020 at 11:46:15 AM UTC+5:30, Chris Angelico wrote:

I recommend looking into CMU Sphinx then. I've used that from Python.
The results are highly entertaining.
ChrisA

Okay I will try it, thank you.

Speech recognition works best when there's a single voice, speaking 
clearly, with little or no background noise. Movies tend not to be like 
that.


Which is why the results are "highly entertaining"...



Well, with enough effort it is possible to build a system that is more
useful than "entertaining". Google did that, English youtube videos can
be annotated with subtitles from speech recognition. For example, try
this video:
https://www.youtube.com/watch?v=lYVLpC_8SQE

Go to the settings thing (the little gear icon in the nav bar) and
switch on subtitles, English autogenerated. You'll see a word-by-word
transcription of the text, and most of it is accurate.


There's not much background noise there; it takes place in a quiet room.


There are strong arguments that anything one can build with open source
tools will be inferior. 1) They'll probably have a bunch of highly
qualified KI experts working on this thing 2) They have an enormous
corpus of training data. Many videos already have user-provided
subtitles. They can feed all of this into the training.

I'm waiting to be disproven on this point ;)


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


[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 38e32872eb3cf0dc9dd8cef9b05e47ba03638d34 by Miss Islington (bot) 
in branch '3.8':
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) 
(GH-22019)
https://github.com/python/cpython/commit/38e32872eb3cf0dc9dd8cef9b05e47ba03638d34


--

___
Python tracker 

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



[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
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



[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks for the report and the PR, vinay0410!

--

___
Python tracker 

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



[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset ca55ecbf9aab305fa301ec69410ca3d3d18ec848 by Miss Islington (bot) 
in branch '3.9':
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) 
(GH-22018)
https://github.com/python/cpython/commit/ca55ecbf9aab305fa301ec69410ca3d3d18ec848


--

___
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-30 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
nosy: +pablogsal
nosy_count: 4.0 -> 5.0
pull_requests: +21120
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22020

___
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-30 Thread Chris Angelico
On Mon, Aug 31, 2020 at 3:16 AM Christian Gollwitzer  wrote:
>
> Am 30.08.20 um 17:25 schrieb MRAB:
> > On 2020-08-30 07:23, Muskan Sanghai wrote:
> >> On Sunday, August 30, 2020 at 11:46:15 AM UTC+5:30, Chris Angelico wrote:
> >>> I recommend looking into CMU Sphinx then. I've used that from Python.
> >>> The results are highly entertaining.
> >>> ChrisA
> >> Okay I will try it, thank you.
> >>
> > Speech recognition works best when there's a single voice, speaking
> > clearly, with little or no background noise. Movies tend not to be like
> > that.
> >
> > Which is why the results are "highly entertaining"...
>
>
> Well, with enough effort it is possible to build a system that is more
> useful than "entertaining". Google did that, English youtube videos can
> be annotated with subtitles from speech recognition. For example, try
> this video:
> https://www.youtube.com/watch?v=lYVLpC_8SQE
>
> Go to the settings thing (the little gear icon in the nav bar) and
> switch on subtitles, English autogenerated. You'll see a word-by-word
> transcription of the text, and most of it is accurate.
>
> There are strong arguments that anything one can build with open source
> tools will be inferior. 1) They'll probably have a bunch of highly
> qualified KI experts working on this thing 2) They have an enormous
> corpus of training data. Many videos already have user-provided
> subtitles. They can feed all of this into the training.
>
> I'm waiting to be disproven on this point ;)
>

The OP doesn't want to use Google's services for this. That doesn't
disprove your point, but... :)

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


[issue37168] small_ints[] modified (third party C-extension?)

2020-08-30 Thread Tim Peters


Tim Peters  added the comment:

Closing, since it remains a unique report and there hasn't been another word 
about it in over a year.

--
resolution:  -> works for me
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



[issue37168] small_ints[] modified (third party C-extension?)

2020-08-30 Thread Stefan Krah


Stefan Krah  added the comment:

If nothing has been diagnosed, I suggest closing this.

--
status: open -> pending

___
Python tracker 

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



[issue37168] small_ints[] modified (third party C-extension?)

2020-08-30 Thread Stefan Krah


Change by Stefan Krah :


--
title: Decimal divisions sometimes 10x or 100x too large -> small_ints[] 
modified (third party C-extension?)

___
Python tracker 

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



[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21119
pull_request: https://github.com/python/cpython/pull/22019

___
Python tracker 

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



[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 475a5fbb5644ea200c990d85d8c264e78ab6c7ea by Vinay Sharma in 
branch 'master':
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556)
https://github.com/python/cpython/commit/475a5fbb5644ea200c990d85d8c264e78ab6c7ea


--
nosy: +pablogsal

___
Python tracker 

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



[issue41344] SharedMemory crash when size is 0

2020-08-30 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +21118
pull_request: https://github.com/python/cpython/pull/22018

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-30 Thread Guido van Rossum

Guido van Rossum  added the comment:

Something just occurred to me. What if the caller has already set
says.argv? We shouldn’t overwrite it. Or what if they only set it (later)
if not already set. Would we break their code?
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue39994] pprint handling of dict subclasses that override __repr__

2020-08-30 Thread Irit Katriel


Irit Katriel  added the comment:

Thank you Serhiy.  This ticket can be closed now.

--

___
Python tracker 

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



[issue18417] urlopen() has a hidden default for its timeout argument

2020-08-30 Thread Facundo Batista


Change by Facundo Batista :


--
nosy:  -facundobatista

___
Python tracker 

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



[issue37168] Decimal divisions sometimes 10x or 100x too large

2020-08-30 Thread Facundo Batista


Change by Facundo Batista :


--
nosy:  -facundobatista

___
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 pull the updated information from a tkinter form?

2020-08-30 Thread Steve
OK, I was closer than I thought.

Two weeks ago, the concept of tkinter and these forms were totally new to me
as well as, about  two days ago, python list was totally new too. I somehow
thought that "window.mainloop()" was supposed to be the last entry in the
function, silly me...
I did not think of returning the list.

Thank you, now it is back for another 30 hours of continuous programming...
(:
Steve


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

-Original Message-
From: Python-list  On
Behalf Of Peter Otten
Sent: Sunday, August 30, 2020 1:55 PM
To: python-list@python.org
Subject: Re: How do I pull the updated information from a tkinter form?

Steve wrote:

> #What I cannot seem to do is to pull the adjusted #information from 
> the form into variables, or a #list/array, so that can be used for the 
> update to the file.

The updated data is in the StringVar-s, which, fortunately, you have
available in a list ;)

So:

> def EditDataByForm():
[...]
> window.mainloop()
  return [spec.get() for spec in New_Specs]

  print(EditDataByForm())
> print ("Done")


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

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


[issue41654] Segfault when raising MemoryError

2020-08-30 Thread hai shi


hai shi  added the comment:

Hm, Looks like we need check the double free risk of `Py_DECREF()`.

--

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-30 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I had the same idea late last night, though after 20 years, I have forgotten 
how to spell "['']" in C.  (Is some sort of allocation or declaration 
required?).

In the doc, change "It does not set sys.argv; use PySys_SetArgvEx() for that." 
to "It initializes sys.argv to ['']; use PySys_SetArgvEx() to modify it or 
change sys.path."

"This is a no-op when called for a second time (without calling Py_FinalizeEx() 
first)." needs to be respected.

--

___
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 pull the updated information from a tkinter form?

2020-08-30 Thread Peter Otten
Steve wrote:

> #What I cannot seem to do is to pull the adjusted
> #information from the form into variables, or a
> #list/array, so that can be used for the update to the file.

The updated data is in the StringVar-s, which, fortunately, you have 
available in a list ;)

So:

> def EditDataByForm():
[...]
> window.mainloop()  
  return [spec.get() for spec in New_Specs]

  print(EditDataByForm())
> print ("Done")


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


[issue39994] pprint handling of dict subclasses that override __repr__

2020-08-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 582f13786bb75c73d609790967fea03a5b50148a by Irit Katriel in 
branch 'master':
bpo-39994: Fix pprint handling of dict subclasses that override __repr__ 
(GH-21892)
https://github.com/python/cpython/commit/582f13786bb75c73d609790967fea03a5b50148a


--

___
Python tracker 

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



How do I pull the updated information from a tkinter form?

2020-08-30 Thread Steve
#  With this program, I can read the information from
#  Specifications.txt file and display it on a form.
#  The user can then update/modify the fields. This is
#  all working fine and beeautifully...
#  
#  I now need to reverse the process and replace the
#  adjusted lines of data back into the Specifications.txt
#  file.  Fortunately, that code has already been
#  written .

#  What I cannot seem to do is to pull the adjusted
#  information from the form into variables, or a
#  list/array, so that can be used for the update to the file.

#  Suggestions for what to look up to study this
#  through will help.
#
#  Thank you
#  Steve
# ---

import tkinter as tk
from tkinter import ttk
import sys

ThisList = ["start"]

#===
def FillTheList():
   x=0
   ThisList = []
   with open("Specifications.txt", 'r') as infile:
 for lineEQN in infile: # loop to find each line in the file for that
dose
 if lineEQN[0:1] == "-": # Lines with "-" in space 1 have special
recognition for this form
   ListItem = lineEQN[1:6].strip() # Remove any spaces before and
after
   ThisList.append(ListItem) #Add the ListItem to ThisList
   return(ThisList)

#

def EditDataByForm():
window = tk.Tk()
window.title("Python Tkinter Text Box")
window.minsize(700,700) #height, width

#===
def GetLineByItem(DataType):  #get line by item in column 3 - 5
#print("DataType = " + DataType)
DataLetter = DataType[0:1] #Capture item letter ID for file check

if DataLetter.isupper(): # == "Specs":
FileToBeEdited = "Specifications.txt"
else:
FileToBeEdited = "DataSpecifications.txt"

with open(FileToBeEdited, 'r') as infile:
 for lineEQN in infile: # loop to find each line in the file for
that dose
   if ((lineEQN[1:2]== DataLetter)):
   A = lineEQN[1:46]# Whole Line
   a = lineEQN[34:46].strip()   # Just the Data
   # print("A = " + A )
   # print("a = " + a)
  
return(A, a) #Return the line and Data separately

#===
def ClickSubmit():
window.destroy()
#===

label = ttk.Label(window, text = "Enter the new readings")
label.grid(column = 1, row = 1)
 
ThisList = FillTheList()
x = 3  # Allows for two rows at the top of the form used for headers
y = 0  # Scans the datafile to fill the list

New_Specs = []
#SpecsToUpdate = []

for lineItem in range(len(ThisList)):

 SpecLine, Spec = GetLineByItem(ThisList[y])
 OldSpec = Spec
 NewSpec = " "

 SVRlabel = ttk.Label(window, text = SpecLine + "  "*5)
 SVRlabel.grid(column = 1, row = x,  sticky=tk.W)

 NewSpec = tk.StringVar()
 New_Specs.append(NewSpec)
 SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
NewSpec)
 
 SVRCodeEntered.grid(column = 2, row = x, pady = 15, sticky=tk.W)
 SVRCodeEntered.insert(0, OldSpec)
 x += 1 
 y += 1

#===
button = ttk.Button(window, text = "Submit", command = ClickSubmit)
button.grid(column= 2, row = 15)
window.mainloop()  
#===

EditDataByForm()
print ("Done")
#  Code needed to pull the updated fields from the form
#  as variables or in a list/array.  Once I have that, the code to replace 
#  code in the specifications.txt file has already been written.

#  Here is a sample of the Specifications.txt file:

---
-E MSN Monitor Serial Number   JNGY263-T4464##   
 -
-F TSL TestStrip Lot Number45001 82990  ##   
-G SED Strip Expire Date   2021-05-31   ##   
 -
-H SSC Sensor Sequence Code71   ##   
-I SCN Sensor Code Number  G03  ##   
-J SSN Sensor Serial Number2021-01-31   ##   
-K SDE Sensor Date to Expire   2021-01-31   ##   
-L SDN Sensor Day Number   12##   
-M FDS First Date for Sensor   Fri Aug 17, 2020 09:34   ##
 -
-N IDT Insulin Dose Total  450  ##




Re: Video file to subtitles file

2020-08-30 Thread Christian Gollwitzer

Am 30.08.20 um 17:25 schrieb MRAB:

On 2020-08-30 07:23, Muskan Sanghai wrote:

On Sunday, August 30, 2020 at 11:46:15 AM UTC+5:30, Chris Angelico wrote:

I recommend looking into CMU Sphinx then. I've used that from Python.
The results are highly entertaining.
ChrisA

Okay I will try it, thank you.

Speech recognition works best when there's a single voice, speaking 
clearly, with little or no background noise. Movies tend not to be like 
that.


Which is why the results are "highly entertaining"...



Well, with enough effort it is possible to build a system that is more 
useful than "entertaining". Google did that, English youtube videos can 
be annotated with subtitles from speech recognition. For example, try 
this video:

https://www.youtube.com/watch?v=lYVLpC_8SQE

Go to the settings thing (the little gear icon in the nav bar) and 
switch on subtitles, English autogenerated. You'll see a word-by-word 
transcription of the text, and most of it is accurate.


There are strong arguments that anything one can build with open source 
tools will be inferior. 1) They'll probably have a bunch of highly 
qualified KI experts working on this thing 2) They have an enormous 
corpus of training data. Many videos already have user-provided 
subtitles. They can feed all of this into the training.


I'm waiting to be disproven on this point ;)

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


[issue40153] json dump with repeated key

2020-08-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This module has been heavily used in the real world and we have no evidence 
that there is an actual problem to be solved.  Marking this as closed.  If a 
real world issue does arise, feel free to reopen and we can consider extending 
the API to have a validation step.

--
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



[issue41637] Calling with an infinite number of parameters is not detected

2020-08-30 Thread Camion


Camion  added the comment:

I understand all that. But the problem is that it should crash the program and 
not the interpreter.

--

___
Python tracker 

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



[issue40486] pathlib's iterdir doesn't specify what happens if directory content change

2020-08-30 Thread Facundo Batista


Facundo Batista  added the comment:

However, Serhiy, `os.listdir()` builds a list quickly and gives you that, so 
the chance of the directory being modified is quite low (however, for big 
directories, that may happen, and it's probably good to notice that in the 
docs).

For `Path.iterdir()` that list is not built, and as it's iteration is external, 
the amount of time between getting one item to the other is unbound, *anything* 
could happen in the middle. 

In short, I think that both docs should state that the directory could change 
while it's iterated (in the os.listdir case probably stating that the chances 
are low).

--

___
Python tracker 

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



[issue15947] Assigning new values to instance of pointer types does not check validity

2020-08-30 Thread Facundo Batista


Facundo Batista  added the comment:

I'm closing this, it looks to me that behaviour changed and this is safe now.

--
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-30 Thread Christoph Zwerschke


Christoph Zwerschke  added the comment:

Had the same problem for years and wondered why nobody else complained.

Still reproducable with Win 10 Pro 2004, Python 3.8, cp1252 locale.

Deleting hh.dat did not solve the problem for me.

--
nosy: +cito

___
Python tracker 

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



[issue40153] json dump with repeated key

2020-08-30 Thread Facundo Batista


Facundo Batista  added the comment:

The balance here is allow an invalid JSON to be created (but documenting that 
on some situations that will happen), or sticking to always produce valid 
JSONs, but with a hit in performance (which we don't know so far if it's big or 
small).

--

___
Python tracker 

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



pyspread 1.99.3 released

2020-08-30 Thread Martin Manns
pyspread 1.99.3
===

This is the third Beta release for pyspread 2.0.

This version concentrates on usability improvements.


About pyspread
==

Pyspread is a non-traditional spreadsheet that is based on and written
in the programming language Python.

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website:   https://pyspread.gitlab.io/
Download page: https://pypi.org/project/pyspread/
Signature for tarball:
   
https://gitlab.com/pyspread/downloads/-/raw/master/releases/pyspread-1.99.3.tar.gz.sig?inline=false
Source code:   https://gitlab.com/pyspread/pyspread


Dependencies


Mandatory:
 * Python (≥ 3.6)
 * numpy (>=1.1) 
 * PyQt5 (≥ 5.10, requires PyQt5.Svg)

Recommended:
 * matplotlib (>=1.1.1)
 * pyenchant (>=1.1)
 * pip (>=18)

For building the apidocs with Sphinx see apidocs/requirements.txt


Known issues


 * While the main issue on the Mac has been solved, there is a report on
   Mac Catalina, which reports that the menu may freeze unless another
   application has been switched to.


Enjoy

Martin
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue39102] Increase Enum performance

2020-08-30 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-30 Thread Guido van Rossum

Guido van Rossum  added the comment:

I think it’s reasonable to expect sys.argv to have at least one item,
possibly empty. The proposed fix of setting it to [“”] seems right to me.
-- 
--Guido (mobile)

--

___
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-30 Thread MRAB

On 2020-08-30 07:23, Muskan Sanghai wrote:

On Sunday, August 30, 2020 at 11:46:15 AM UTC+5:30, Chris Angelico wrote:
On Sun, Aug 30, 2020 at 4:11 PM Muskan Sanghai  wrote: 
> 
> On Sunday, August 30, 2020 at 10:57:00 AM UTC+5:30, Christian Gollwitzer wrote: 
> > Am 29.08.20 um 13:51 schrieb Muskan Sanghai: 
> > > I want to extract subtitles from a MPEG video (which does not have any previous subtitles) 
> > I'm still not sure I get it. "Extract" subtitles, when they are NOT 
> > there? Can it be, by any chance, that you are talking about speech 
> > recognition? I.e., you want a software which understands the spoken word 
> > in the movie sound and turns that into text, which can be shown as 
> > subtitles? Like the "auto-generated" subtitles which youtube offers for 
> > some videos. 
> > 
> > If so, it is a complex task and will not work overly well. I defer to 
> > the experts if there are any usable speech recognitino engines for this 
> > task. 
> > 
> > Christian 
> Yes, this is what I exactly want to do. I want to create a software which understands the spoken word in the movie sound and turns that into text. 
>
I recommend looking into CMU Sphinx then. I've used that from Python. 

The results are highly entertaining. 


ChrisA

Okay I will try it, thank you.

Speech recognition works best when there's a single voice, speaking 
clearly, with little or no background noise. Movies tend not to be like 
that.


Which is why the results are "highly entertaining"...
--
https://mail.python.org/mailman/listinfo/python-list


RE: How do I left-justify the information in the labels?

2020-08-30 Thread Steve
It turned out to be "sticky=tk.W" instead of "sticky=tkinter.w"
Probably because I have   "import tkinter as tk"
It does work though.

Mischief Managed
Steve


FootNote:
If money does not grow on trees, then why do banks have branches?

-Original Message-
From: Python-list  On
Behalf Of Peter Otten
Sent: Sunday, August 30, 2020 10:32 AM
To: python-list@python.org
Subject: Re: How do I left-justify the information in the labels?

Steve wrote:

> How do I left-justify the information in the labels?

>  SVRlabel = ttk.Label(window, text = SpecLine + "  "*5)
>  SVRlabel.grid(column = 1, row = x)

The text in the labels already is left-justified -- but the labels
themselves are centered inside the grid cells.

You can change that with

label = ttk.Label(window, text=SpecLine) label.grid(column=1, row=x,
sticky=tkinter.W)  # W for "west"

See https://tkdocs.com/shipman/grid.html.

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

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


[issue41402] email: ContentManager.set_content calls nonexistent method encode() on bytes

2020-08-30 Thread Johannes Reiff


Johannes Reiff  added the comment:

It has been almost a month since the last update, so pinging as suggested in 
the Developer's Guide. Do I need to do something before the PR can be merged?

--

___
Python tracker 

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



[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2020-08-30 Thread Ben Darnell


Ben Darnell  added the comment:

I've posted a pull request with a test and fix: 
https://github.com/python/cpython/pull/22017. It's a more targeted fix than 
cmeyer's PR (which I didn't even notice until now due to unfamiliarity with the 
BPO UI)

--

___
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 left-justify the information in the labels?

2020-08-30 Thread Peter Otten
Steve wrote:

> How do I left-justify the information in the labels?

>  SVRlabel = ttk.Label(window, text = SpecLine + "  "*5)
>  SVRlabel.grid(column = 1, row = x)

The text in the labels already is left-justified -- but the labels 
themselves are centered inside the grid cells.

You can change that with

label = ttk.Label(window, text=SpecLine)
label.grid(column=1, row=x, sticky=tkinter.W)  # W for "west"

See https://tkdocs.com/shipman/grid.html.

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


Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Barry


> On 30 Aug 2020, at 11:03, Stephane Tougard via Python-list 
>  wrote:
> 
> On 2020-08-30, Chris Angelico  wrote:
>>> I'm not even that makes sense, how 2 processes can share a thread ?
>>> 
>> They can't. However, they can share a Thread object, which is the
>> Python representation of a thread. That can lead to confusion, and
>> possibly the OP's error (I don't know for sure, I'm just positing).
> 
> A fork() is a copy of a process in a new process. If this process has a
> thread (or several), they are part of the copy and the new process has
> those threads as well.

No. See https://www.man7.org/linux/man-pages/man2/fork.2.html which says:

“ Note the following further points:

   *  The child process is created with a single thread—the one that
  called fork().  The entire virtual address space of the parent is
  replicated in the child, including the states of mutexes,
  condition variables, and other pthreads objects; the use of
  pthread_atfork(3) may be helpful for dealing with problems that
  this can cause.”

Barry
> 
> Unless there is a memory sharing between those processes, what happens
> on one thread in the first process is totally independant of what
> happens in the copy of this thread in the other process.
> 
> I'm not specialist on multi-threading in Python, but it should not
> change anything. Both processes (father and child) don't share the same
> thread, each one has its own copy of the thread.
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2020-08-30 Thread Ben Darnell


Change by Ben Darnell :


--
pull_requests: +21117
pull_request: https://github.com/python/cpython/pull/22017

___
Python tracker 

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



Re: Where read() is documented

2020-08-30 Thread Chris Green
Stefan Ram  wrote:
> Chris Green  writes:
> >I went to sys.stdin but it didn't really lead me easily to the read()
> >method.  All I actually wanted to know was what was the type of the
> >return value of the read() method which is different in Python 2 and 3.
> 
> |>>> import sys
> |>>> >>> sys.stdin.read
> 
> |>>> help(sys.stdin.read)
> |Help on built-in function read:
> |
> |read(size=-1, /) method of _io.TextIOWrapper instance
> |Read at most n characters from stream.
> |
> |Read from underlying buffer until we have n characters or we hit EOF.
> |If n is negative or omitted, read until EOF.
> |
> |>>> type(sys.stdin.read())
> |^Z
> |
> 
>   Note that above it's called a "method" twice and once
>   a "function".
> 
>   (If I would have written the body of the documentation,
>   I'd use "size" instead of "n" and clearly separate 
>   effects and results, e.g.,
> 
> |EFFECTS
> |
> |If  is not negative, read from underlying buffer until
> | characters are read or until EOF was read. If 
> |is negative or omitted, read until EOF.
> |
> |RESULT
> |
> |The string read, type str, excluding a possible EOF read.
> 
Yes, I must admit I tend to forget about the 'built-in' documentation
that Python has.  Coming from assembler, C and C++ one doesn't expect
it, so I'm afraid I tend to search the on-line Python documentation.
Usually I find what I want but in this particular case I didn't.  I
must remember the interactive prompt!

Thanks.

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


[issue41666] fix

2020-08-30 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I agree with xtreak. I guess you probably misspelled the initial word:

>>> 'Python'[2:5]  # same as the tutorial
'tho'

>>> 'Pyhton'[2:5]  # misspelling
'hto'

--
nosy: +steven.daprano

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-30 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

One possible option to guarantee initialization could be for PyInitialize to 
always call PySys_SetArgvEx(1, [""], 0), providing a default value for embedded 
interpreters that fail to call it.

--

___
Python tracker 

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



[issue41666] fix

2020-08-30 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Closing this as not a bug since the example seems to be correct. Feel free to 
reopen with more details if needed.

--
nosy: +xtreak
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



[issue41666] fix

2020-08-30 Thread M-o-T


Change by M-o-T :


--
title: Problem in tutorial/introduction.html#strings -> fix

___
Python tracker 

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



[issue41666] Problem in tutorial/introduction.html#strings

2020-08-30 Thread M-o-T


Change by M-o-T :


--
nosy:  -mohammadtavakoli1378

___
Python tracker 

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



[issue41666] Problem in tutorial/introduction.html#strings

2020-08-30 Thread M-o-T


New submission from M-o-T :

Hi, I found a problem with this address
https://docs.python.org/3/tutorial/introduction.html#strings

In here
>>> word[0:2]  # characters from position 0 (included) to 2 (excluded)
'Py'
>>> word[2:5]  # characters from position 2 (included) to 5 (excluded)
'tho'

In the second example word[2:5] becomes 'hto'

--
messages: 376104
nosy: mohammadtavakoli1378
priority: normal
severity: normal
status: open
title: Problem in tutorial/introduction.html#strings
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



How do I left-justify the information in the labels?

2020-08-30 Thread Steve
for lineItem in range(len(ThisList)):

 SpecLine, Spec = GetLineByItem(ThisList[y])
 OldSpec = Spec
 NewSpec = " "

 SVRlabel = ttk.Label(window, text = SpecLine + "  "*5)
 SVRlabel.grid(column = 1, row = x)
 
 NewSpec = tk.StringVar()
 New_Specs.append(NewSpec)
 SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
NewSpec)
 SVRCodeEntered.grid(column = 2, row = x, pady = 15)
 SVRCodeEntered.insert(0, OldSpec)
 x += 1 
 y += 1

Steve



Footnote:
Some mornings it just isn't worth chewing through the leather straps.

- 

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


RE: Problem running a FOR loop

2020-08-30 Thread Steve
Yes, that first option worked.
Special thanks...
Steve
===

Footnote:
If 666 is considered evil, then technically, 25.8069758 is the root of all
evil.

-Original Message-
From: Python-list  On
Behalf Of Peter Otten
Sent: Sunday, August 30, 2020 5:29 AM
To: python-list@python.org
Subject: Re: Problem running a FOR loop

Steve wrote:

> Compiles, no syntax errors however, line 82 seems to run only once 
> when the FOR loop has completed.
> Why is that?  All fields are to contain the specifications, not just 
> the last one.

It seems that passing the StringVar to the Entry widget is not sufficient to
keep it alive.

> for lineItem in range(len(ThisList)):

>  NewSpec = tk.StringVar()
>  SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
> NewSpec)

When the previous NewSpec is overwritten with the current one the previous
gets garbage-collected and its value is lost. 

The straight-forward fix is to introduce a list:

  new_specs = []
> for lineItem in range(len(ThisList)):

>  NewSpec = tk.StringVar()
   new_specs.append(NewSpec)
>  SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
> NewSpec)

Another option is to store the StringVar as an attribute of the Entry:

> for lineItem in range(len(ThisList)):

>  NewSpec = tk.StringVar()
>  SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
> NewSpec)
   SVRCodeEntered.new_spec = NewSpec


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

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


Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Stephane Tougard via Python-list
On 2020-08-30, Chris Angelico  wrote:
>> I'm not even that makes sense, how 2 processes can share a thread ?
>>
> They can't. However, they can share a Thread object, which is the
> Python representation of a thread. That can lead to confusion, and
> possibly the OP's error (I don't know for sure, I'm just positing).

A fork() is a copy of a process in a new process. If this process has a
thread (or several), they are part of the copy and the new process has
those threads as well.

Unless there is a memory sharing between those processes, what happens
on one thread in the first process is totally independant of what
happens in the copy of this thread in the other process.

I'm not specialist on multi-threading in Python, but it should not
change anything. Both processes (father and child) don't share the same
thread, each one has its own copy of the thread.

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


Re: Problem running a FOR loop

2020-08-30 Thread Peter Otten
Steve wrote:

> Compiles, no syntax errors however, line 82 seems to run only once when
> the FOR loop has completed.
> Why is that?  All fields are to contain the specifications, not just the
> last one.

It seems that passing the StringVar to the Entry widget is not sufficient to 
keep it alive.

> for lineItem in range(len(ThisList)):

>  NewSpec = tk.StringVar()
>  SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
> NewSpec)

When the previous NewSpec is overwritten with the current one the previous 
gets garbage-collected and its value is lost. 

The straight-forward fix is to introduce a list:

  new_specs = []
> for lineItem in range(len(ThisList)):

>  NewSpec = tk.StringVar()
   new_specs.append(NewSpec)
>  SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
> NewSpec)

Another option is to store the StringVar as an attribute of the Entry:

> for lineItem in range(len(ThisList)):

>  NewSpec = tk.StringVar()
>  SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
> NewSpec)
   SVRCodeEntered.new_spec = NewSpec


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


Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Barry Scott



> On 29 Aug 2020, at 18:01, Dennis Lee Bieber  wrote:
> 
> On Sat, 29 Aug 2020 18:24:10 +1000, John O'Hagan 
> declaimed the following:
> 
>> There's no error without the sleep(1), nor if the Process is started
>> before the Thread, nor if two Processes are used instead, nor if two
>> Threads are used instead. IOW the error only occurs if a Thread is
>> started first, and a Process is started a little later.
>> 
>> Any ideas what might be causing the error?
>> 
> 
>   Under Linux, multiprocessing creates processes using fork(). That means
> that, for some fraction of time, you have TWO processes sharing the same
> thread and all that entails (if it doesn't overlay the forked process with
> a new executable, they are sharing the thread until the thread exits).

In the parent you have 1 or more threads.

After fork the new process has 1 thread, which is not shared with the parent.
Any extra threads are not in the new process. But the memory in the new
process will have data structures from the parents other threads.

So no you never have two processes sharing an threads.

This leads to problems with locks.

Barry


> 
> https://stackoverflow.com/questions/54466572/how-to-properly-multithread-in-opencv-in-2019
> (which points to)
> https://answers.opencv.org/question/32415/thread-safe/?answer=32452#post-id-32452
> """
> The library itself is thread safe in that you can have multiple calls into
> the library at the same time, however the data is not always thread safe.
> """
> 
>   The sleep(1), when compounded with the overhead of starting the thread,
> and then starting the process, likely means the thread had exited before
> the process actually is started. Try replacing the sleep(2) in the work
> code with something like sleep(30) -- I hypothesize that you'll get the
> same error condition even with the sleep(1) in place.
> 
> 
> -- 
>   Wulfraed Dennis Lee Bieber AF6VN
>   wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Problem running a FOR loop

2020-08-30 Thread Steve
Compiles, no syntax errors however, line 82 seems to run only once when the
FOR loop has completed.
Why is that?  All fields are to contain the specifications, not just the
last one.

Steve

--
ThisList = ["start"]

#===
def FillTheList():
   x=0
   ThisList = []
   with open("Specifications.txt", 'r') as infile:
 for lineEQN in infile: # loop to find each line in the file for that
dose
 if lineEQN[0:1] == "-":
   ListItem = lineEQN[1:6].strip()
   ThisList.append(ListItem)

   return(ThisList)

#

def EditDataByForm():

import tkinter as tk
from tkinter import ttk
import sys

window = tk.Tk()

window.title("Python Tkinter Text Box")
window.minsize(700,700) #height, width

#===
def GetLineByItem(DataType):  #get line by item in column 3 - 5
#print("DataType = " + DataType)
DataLetter = DataType[0:1]

if DataLetter.isupper(): # == "Specs":
FileToBeEdited = "Specifications.txt"
else:
FileToBeEdited = "DataSpecifications.txt"

with open(FileToBeEdited, 'r') as infile:
 for lineEQN in infile: # loop to find each line in the file for
that dose
   if ((lineEQN[1:2]== DataLetter)):
   A = lineEQN[1:46]# Whole Line
   a = lineEQN[34:46].strip()   # Just the Data
   # print("A = " + A )
   # print("a = " + a)
  
return(A, a)

#===

def ClickSubmit():
window.destroy()
#===

label = ttk.Label(window, text = "Enter the new readings")
label.grid(column = 1, row = 1)
 
ThisList = FillTheList()
x = 3  # Allows for two rows at the top of the form used for headers
y = 0  # Scans the datafile to fill the list

for lineItem in range(len(ThisList)):

 SpecLine, Spec = GetLineByItem(ThisList[y])
 OldSpec = Spec
 #print("OldSpec = " + OldSpec)
 NewSpec = " "

 SVRlabel = ttk.Label(window, text = SpecLine + "  "*5)
 SVRlabel.grid(column = 1, row = x)
 
 NewSpec = tk.StringVar()
 SVRCodeEntered = ttk.Entry(window, width = 15, textvariable =
NewSpec)
 SVRCodeEntered.grid(column = 2, row = x, pady = 15)

 print("x , y = " + str(x) + ", " + str(y))
 
 print("OldSpec2 = <" + OldSpec + "> ") #Use of <> show spaces if
any

 #81 The next line seems to run only once at the end of the FOR loop
<<
 SVRCodeEntered.insert(0, OldSpec)

 SVRCodeEntered.focus_set()

 x += 1 
 y += 1
#===
button = ttk.Button(window, text = "Submit", command = ClickSubmit)
button.grid(column= 2, row = 15)

window.mainloop()  
--
Specifications.txt.  This will align when using Notepad++.

A LTD Last Time Date  2020-08-29 00:55:18.610102   ##   
 B LDL Last Dose Line  2020-08-29 00:55:18.610102   ##   
 C LLL Last LTD line   2020-08-29 00:55:18.610102   ##   
 D LTD Last Time Date  2020-08-29 00:55:18.610102   ##   
 -
-E MSN Monitor Serial Number   JNGY263-T4464##   
 -
-F TSL TestStrip Lot Number45001 82990  ##   
-G SED Strip Expire Date   2021-05-31   ##   
 -
-H SSC Sensor Sequence Code71   ##   
-I SCN Sensor Code Number  G03  ##   
-J SSN Sensor Serial Number2021-01-31   ##   
-K SDE Sensor Date to Expire   2021-01-31   ##   
-L SDN Sensor Day Number   12##   
-M FDS First Date for Sensor   Fri Aug 17, 2020 09:34   ##
 -
-N IDT Insulin Dose Total  450  ##

 O DTD Data Time Date  Fri Aug 07, 2020 21:30   ##   
 P PTD Previous Time Date  Thu Nov 27, 1952 14:30   ##   
 -
 Q HL1 Half Life 1 1##

 R HL2 Half LIfe 2 2##   
 S HL3 Half Life 3 3##
 T TIL Total Insulin Layer 25   ##

---
Footnote:
The power company in 

Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread John O'Hagan
On Sat, 29 Aug 2020 13:01:12 -0400
Dennis Lee Bieber  wrote:

> On Sat, 29 Aug 2020 18:24:10 +1000, John O'Hagan
>  declaimed the following:
> 
> >There's no error without the sleep(1), nor if the Process is started
> >before the Thread, nor if two Processes are used instead, nor if two
> >Threads are used instead. IOW the error only occurs if a Thread is
> >started first, and a Process is started a little later.
> >
> >Any ideas what might be causing the error?
> >  
> 
>   Under Linux, multiprocessing creates processes using fork().
> That means that, for some fraction of time, you have TWO processes
> sharing the same thread and all that entails (if it doesn't overlay
> the forked process with a new executable, they are sharing the thread
> until the thread exits).
> 
> https://stackoverflow.com/questions/54466572/how-to-properly-multithread-in-opencv-in-2019
> (which points to)
> https://answers.opencv.org/question/32415/thread-safe/?answer=32452#post-id-32452
> """
> The library itself is thread safe in that you can have multiple calls
> into the library at the same time, however the data is not always
> thread safe. """
> 
>   The sleep(1), when compounded with the overhead of starting
> the thread, and then starting the process, likely means the thread
> had exited before the process actually is started. Try replacing the
> sleep(2) in the work code with something like sleep(30) -- I
> hypothesize that you'll get the same error condition even with the
> sleep(1) in place.
> 
> 

Thanks for the reply. 

You're right, the error also happens with a longer sleep, or no sleep
at all, inside the function. That sleep is only there in the example to
keep the windows open long enough to see the images if they are
successfully displayed.

I could well be wrong as I'm not fully across multiprocessing, but I
think the Stackoverflow question and answer you linked above relate to a
different situation, with multithreaded cv2 operations on shared image
data. 

In my example, AFAIK (which is not very far) it shouldn't matter whether
the new process is sharing the thread, or whether the thread has
exited, because the thread and the process aren't using the same data.
Or (as is quite likely) am I misunderstanding your point?

Cheers

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


Re: Where read() is documented

2020-08-30 Thread Chris Green
MRAB  wrote:
> On 2020-08-29 17:48, Chris Green wrote:
> > Stefan Ram  wrote:
> >> Chris Green  writes:I can't find the documentation for
> >> >read().  It's not a built-in function and it's not documented with
> >> >(for example) the file type object sys.stdin.
> >> 
> >> |read() (asyncio.StreamReader method), 894
> >> |read() (chunk.Chunk method), 1385
> >> |read() (codecs.StreamReader method), 164
> >> |read() (configparser.ConfigParser method), 537
> >> |read() (http.client.HTTPResponse method), 1276
> >> |read() (imaplib.IMAP4 method), 1291
> >> |read() (in module os), 578
> >> |read() (io.BufferedIOBase method), 622
> >> |read() (io.BufferedReader method), 625
> >> |read() (io.RawIOBase method), 621
> >> |read() (io.TextIOBase method), 626
> >> |read() (mimetypes.MimeTypes method), 1146
> >> |read() (mmap.mmap method), 1053
> >> |read() (ossaudiodev.oss_audio_device method), 1388
> >> |read() (ssl.MemoryBIO method), 1024
> >> |read() (ssl.SSLSocket method), 1005
> >> |read() (urllib.robotparser.RobotFileParser method), 1268
> >> |read() (zipfile.ZipFile method), 499
> >> Index of "The Python Library Reference, Release 3.9.0a3"
> >> 
> >> 
> > But none of those is the documentation for read(), they're just places
> > that refer to read().
> > 
> There's no read() function. What you're referring to are the 'read' 
> methods of various classes.
> 
Yes, OK, method rather than function.


> If you open a file in text mode, you'll get an instance of 
> TextIOWrapper, which inherits .read from TextIOBase.
> 
> If you open a file in binary mode, you'll get an instance of 
> BufferedReader, which has a .read method.
> 
> Multiple classes, each with its own 'read' method.
> 
> sys.stdin is an instance of TextIOWrapper, so for that you should look 
> at the methods of TextIOWrapper.

I went to sys.stdin but it didn't really lead me easily to the read()
method.  All I actually wanted to know was what was the type of the
return value of the read() method which is different in Python 2 and 3.

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


Re: Silly question, where is read() documented?

2020-08-30 Thread Chris Green
Terry Reedy  wrote:
> On 8/29/2020 12:18 PM, Chris Green wrote:
> > Well it sounds a silly question but I can't find the documentation for
> > read().  It's not a built-in function and it's not documented with
> > (for example) the file type object sys.stdin.
> 
> sys.stdin is of no particular type, but must at least have a .read method.
> 
> > So where is it documented?  :-)
> 
> >>> import sys; sys.stdin
> should give a hint.  In the standard REPL,
> 
> <_io.TextIOWrapper name='' mode='r' encoding='utf-8'>
> 
> As others said, actually look in the io module doc.  You might spend 
> some time reading the doc to get an idea of what is going on.  If you 
> run from IDLE, you currently get
> 
> 
> (I should make that more like the REPL answer.)
> 
Yes, quite! :-)

All I actually wanted to find out was the difference between what is
returned by sys.stdin.read() in Python 2 and Python 3 as that turned
out to be the fundamental cause of the mail handling problem I have
been airing in other threads here.

-- 
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-30 Thread Chris Green
Cameron Simpson  wrote:
> On 29Aug2020 16:50, Chris Green  wrote:
> >However the problem appears to be that internally in Python 3 mailbox
> >class there is an assumption that it's being given 'ascii'.  Here's
> >the error (and I'm doing no processing of the message at all):-
> >
> >Traceback (most recent call last):
> >  File "/home/chris/.mutt/bin/filter.py", line 102, in 
> >mailLib.deliverMboxMsg(dest, msg, log)
> >  File "/home/chris/.mutt/bin/mailLib.py", line 52, in deliverMboxMsg
> >mbx.add(msg)
> [...]
> 
> Here is the entire save-to-mbox code form my own mailfiler:
> 
> text = M.as_string(True).replace('\nFrom ', '\n>From ')
> with open(folderpath, "a") as mboxfp:
>   mboxfp.write(text)
> 
> where M is the current message, a Message object.
> 
> Note that this does _not_ assume ASCII output. The process here is:
> 
> - transcribe the message to a Python 3 str (so Unicode code points)
> - replace embedded "From " to protect the mbox format
> - open the mbox for append - the _default_ encoding is utf-8
> - write the message in utf-8 because of the open mode
> 
> This sidesteps the library you're using which may well do something 
> ASCII based. And it has _never_ failed for me.
> 
Thanks Caneron, but I have now finally fixed my problem, see the new
thread.

-- 
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-30 Thread Chris Green
Karsten Hilbert  wrote:
> > However the problem appears to be that internally in Python 3 mailbox
> > class there is an assumption that it's being given 'ascii'.
> 
> Do you really _need_ the mailbox class ? From what you've
> written so far my understanding was that you receive data
> (bytes) and want to append that to a file (which happens
> to be an mbox).
> 
> Can't you "just do that" ?
> 
> IOW, read the bytes, open the file, dump the bytes, close the file ?
> 
This would have been my next approach but see the new thread I've
started about this.  The fis was to change the read from stdin so that
it produced bytes instead of a string.  The bytes are fed into the
mailbox class and it no longer tries to decode them.

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


Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Karen Shaeffer via Python-list


> On Aug 29, 2020, at 10:12 PM, Stephane Tougard via Python-list 
>  wrote:
> 
> On 2020-08-29, Dennis Lee Bieber  wrote:
>>  Under Linux, multiprocessing creates processes using fork(). That means
>> that, for some fraction of time, you have TWO processes sharing the same
>> thread and all that entails (if it doesn't overlay the forked process with
>> a new executable, they are sharing the thread until the thread exits).
>> same error condition even with the sleep(1) in place.
> 
> I'm not even that makes sense, how 2 processes can share a thread ?
> 

Hello,
On linux, fork is a kernel system call. The linux kernel creates two identical 
processes running in separate memory spaces. At the time of creation, these 
memory spaces have the same content. There are some issues to be aware of. Just 
type ‘man fork’ on the command line of a linux system, and you can read about 
the issues of concern, presuming you have installed the manual pages for the 
linux kernel system calls.

If the forked process doesn’t overlay onto a separate memory space, then the 
fork system call fails, returning a failure code to the parent process. When 
the linux kernel is executing the fork system call, the parent (forking 
process) is blocked on the system call. The linux kernel actually takes over 
the parent process during execution of the system call, running that process in 
kernel mode during the execution of the fork process. The parent (forking) 
process only restarts, after the kernel returns.

On linux, within a given process, threads share the same memory space. If that 
process is the python interpreter, then the Global lock ensures only one thread 
is running when the fork happens. After the fork, then you have two distinct 
processes running in two separate memory spaces. And the fork man page 
discusses the details of concern with regards to specific kernel resources that 
could be referenced by those two distinct processes. The thread context is just 
a detail in that respect. All the threads of the parent process that forked the 
new process all share the same parent memory space.

humbly,
kls

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


[issue41524] PyOS_mystricmp advances pointers too far

2020-08-30 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 85ca9c049c5a490d143d28933bbb02ab80394ed8 by Miss Islington (bot) 
in branch '3.8':
bpo-41524: fix pointer bug in PyOS_mystr{n}icmp (GH-21845) (GH-22016)
https://github.com/python/cpython/commit/85ca9c049c5a490d143d28933bbb02ab80394ed8


--

___
Python tracker 

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



[issue41524] PyOS_mystricmp advances pointers too far

2020-08-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thanks William

--
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



[issue41524] PyOS_mystricmp advances pointers too far

2020-08-30 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 901c2eae6e27ee7793e5a3c638664e01a3bf8de8 by Miss Islington (bot) 
in branch '3.9':
bpo-41524: fix pointer bug in PyOS_mystr{n}icmp (GH-21845) (GH-21978)
https://github.com/python/cpython/commit/901c2eae6e27ee7793e5a3c638664e01a3bf8de8


--

___
Python tracker 

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



[issue41524] PyOS_mystricmp advances pointers too far

2020-08-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21116
pull_request: https://github.com/python/cpython/pull/22016

___
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-30 Thread Muskan Sanghai
On Sunday, August 30, 2020 at 11:46:15 AM UTC+5:30, Chris Angelico wrote:
> On Sun, Aug 30, 2020 at 4:11 PM Muskan Sanghai  wrote: 
> > 
> > On Sunday, August 30, 2020 at 10:57:00 AM UTC+5:30, Christian Gollwitzer 
> > wrote: 
> > > Am 29.08.20 um 13:51 schrieb Muskan Sanghai: 
> > > > I want to extract subtitles from a MPEG video (which does not have any 
> > > > previous subtitles) 
> > > I'm still not sure I get it. "Extract" subtitles, when they are NOT 
> > > there? Can it be, by any chance, that you are talking about speech 
> > > recognition? I.e., you want a software which understands the spoken word 
> > > in the movie sound and turns that into text, which can be shown as 
> > > subtitles? Like the "auto-generated" subtitles which youtube offers for 
> > > some videos. 
> > > 
> > > If so, it is a complex task and will not work overly well. I defer to 
> > > the experts if there are any usable speech recognitino engines for this 
> > > task. 
> > > 
> > > Christian 
> > Yes, this is what I exactly want to do. I want to create a software which 
> > understands the spoken word in the movie sound and turns that into text. 
> >
> I recommend looking into CMU Sphinx then. I've used that from Python. 
> 
> The results are highly entertaining. 
> 
> ChrisA
Okay I will try it, thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Video file to subtitles file

2020-08-30 Thread Chris Angelico
On Sun, Aug 30, 2020 at 4:11 PM Muskan Sanghai  wrote:
>
> On Sunday, August 30, 2020 at 10:57:00 AM UTC+5:30, Christian Gollwitzer 
> wrote:
> > Am 29.08.20 um 13:51 schrieb Muskan Sanghai:
> > > I want to extract subtitles from a MPEG video (which does not have any 
> > > previous subtitles)
> > I'm still not sure I get it. "Extract" subtitles, when they are NOT
> > there? Can it be, by any chance, that you are talking about speech
> > recognition? I.e., you want a software which understands the spoken word
> > in the movie sound and turns that into text, which can be shown as
> > subtitles? Like the "auto-generated" subtitles which youtube offers for
> > some videos.
> >
> > If so, it is a complex task and will not work overly well. I defer to
> > the experts if there are any usable speech recognitino engines for this
> > task.
> >
> > Christian
> Yes, this is what I exactly want to do. I want to create a software which 
> understands the spoken word in the movie sound and turns that into text.
>

I recommend looking into CMU Sphinx then. I've used that from Python.

The results are highly entertaining.

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


Re: Video file to subtitles file

2020-08-30 Thread Muskan Sanghai
On Sunday, August 30, 2020 at 10:57:00 AM UTC+5:30, Christian Gollwitzer wrote:
> Am 29.08.20 um 13:51 schrieb Muskan Sanghai:
> > I want to extract subtitles from a MPEG video (which does not have any 
> > previous subtitles)
> I'm still not sure I get it. "Extract" subtitles, when they are NOT 
> there? Can it be, by any chance, that you are talking about speech 
> recognition? I.e., you want a software which understands the spoken word 
> in the movie sound and turns that into text, which can be shown as 
> subtitles? Like the "auto-generated" subtitles which youtube offers for 
> some videos. 
> 
> If so, it is a complex task and will not work overly well. I defer to 
> the experts if there are any usable speech recognitino engines for this 
> task. 
> 
> Christian
Yes, this is what I exactly want to do. I want to create a software which 
understands the spoken word in the movie sound and turns that into text.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41665] Empty

2020-08-30 Thread Damien Ruiz


New submission from Damien Ruiz :

Didn't mean to create this and can't delete.

--
stage:  -> resolved
status: open -> closed
title: Function called -> Empty

___
Python tracker 

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



[issue41665] Function called

2020-08-30 Thread Damien Ruiz


Change by Damien Ruiz :


--
nosy: x_0euf
priority: normal
severity: normal
status: open
title: Function called

___
Python tracker 

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



Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Chris Angelico
On Sun, Aug 30, 2020 at 4:01 PM Stephane Tougard via Python-list
 wrote:
>
> On 2020-08-29, Dennis Lee Bieber  wrote:
> >   Under Linux, multiprocessing creates processes using fork(). That 
> > means
> > that, for some fraction of time, you have TWO processes sharing the same
> > thread and all that entails (if it doesn't overlay the forked process with
> > a new executable, they are sharing the thread until the thread exits).
> > same error condition even with the sleep(1) in place.
>
> I'm not even that makes sense, how 2 processes can share a thread ?
>

They can't. However, they can share a Thread object, which is the
Python representation of a thread. That can lead to confusion, and
possibly the OP's error (I don't know for sure, I'm just positing).

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


Re: Threading plus multiprocessing plus cv2 error

2020-08-30 Thread Stephane Tougard via Python-list
On 2020-08-29, Dennis Lee Bieber  wrote:
>   Under Linux, multiprocessing creates processes using fork(). That means
> that, for some fraction of time, you have TWO processes sharing the same
> thread and all that entails (if it doesn't overlay the forked process with
> a new executable, they are sharing the thread until the thread exits).
> same error condition even with the sleep(1) in place.

I'm not even that makes sense, how 2 processes can share a thread ?


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