Re: Output showing "None" in Terminal

2020-08-27 Thread Py Noob
Thank you so much for the help. I'm self-studying and watching tutorials on youTube. The problem was given as an exercise after the tutorial. I did modify my code based on the suggestions here and it helps. Thank you! On Tue, Aug 25, 2020 at 4:31 PM Schachner, Joseph < joseph.schach...@teledyne.

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

2020-08-27 Thread Cameron Simpson
On 27Aug2020 14:36, Chris Green wrote: >Cameron Simpson wrote: >> I do ok, though most of my message processing happens to messages >> already landed in my "spool" Maildir by getmail. My setup uses getmail >> to get messages with POP into a single Maildir, and then I process the >> message files

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

2020-08-27 Thread Cameron Simpson
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

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

2020-08-27 Thread Marco Sulla
Are you sure you want `str()`? >>> str(b'aaa') "b'aaa'" Probably you want: map(lambda x: x.decode(), bbb) -- 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-27 Thread Chris Angelico
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 ob

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

2020-08-27 Thread Chris Green
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

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread MRAB
On 2020-08-27 17:29, Barry Scott wrote: On 26 Aug 2020, at 16:10, Chris Green wrote: UnicodeEncodeError: 'ascii' codec can't encode character '\ufeff' in position 4: ordinal not in range(128) So what do I need to do to the message I'm adding with mbx.add(msg) to fix this? (I assume that'

Re: Video file to subtitles file

2020-08-27 Thread Barry Scott
> 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 wa

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-27 Thread Dieter Maurer
Samuel Marks wrote at 2020-8-27 15:58 +1000: >The main thing I want is type safety. I want Python to complain if the >callee uses the wrong argument types, and to provide suggestions on >what's needed and info about it. > >Without a base class I can just have docstrings and type annotations >to ach

Video file to subtitles file

2020-08-27 Thread Muskan Sanghai
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. -- https://mail.python.org/mailman/listinfo/python-list

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Barry Scott
> On 26 Aug 2020, at 16:10, Chris Green wrote: > > UnicodeEncodeError: 'ascii' codec can't encode character '\ufeff' in > position 4: ordinal not in range(128) > > So what do I need to do to the message I'm adding with mbx.add(msg) to > fix this? (I assume that's what I need to do). >>> i

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Barry
> On 27 Aug 2020, at 10:40, Chris Green wrote: > > Karsten Hilbert wrote: >>> Terry Reedy wrote: > On 8/26/2020 11:10 AM, Chris Green wrote: > >> I have a simple[ish] local mbox mail delivery module as follows:- > ... >> It has run faultlessly for many years under Python

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Chris Green
Richard Damon wrote: > On 8/27/20 4:31 AM, Chris Green wrote: > > While an E-Mail body possibly *shouldn't* have non-ASCII characters in > > it one must be able to handle them without errors. In fact haven't > > the RFCs changed such that the message body should be 8-bit clean? > > Anyway I think

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

2020-08-27 Thread Chris Green
Cameron Simpson wrote: > On 27Aug2020 09:16, Chris Green wrote: > >Cameron Simpson wrote: > >> But note: joining bytes like strings is uncommon, and may indicate > >> that > >> you should be working in strings to start with. Eg you may want to > >> convert popmsg from bytes to str and do a str.

Aw: Re: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Karsten Hilbert
> > > Because of this, the Python 3 str type is not suitable to store an email > > > message, since it insists on the string being Unicode encoded, > > > > I should greatly appreciate to be enlightened as to what > > a "string being Unicode encoded" is intended to say ? > > > > A Python 3 "str" or

Re: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Chris Angelico
On Thu, Aug 27, 2020 at 11:10 PM Karsten Hilbert wrote: > > > Because of this, the Python 3 str type is not suitable to store an email > > message, since it insists on the string being Unicode encoded, > > I should greatly appreciate to be enlightened as to what > a "string being Unicode encoded"

Aw: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Karsten Hilbert
> Because of this, the Python 3 str type is not suitable to store an email > message, since it insists on the string being Unicode encoded, I should greatly appreciate to be enlightened as to what a "string being Unicode encoded" is intended to say ? Thanks, Karsten -- https://mail.python.org/ma

Re: Python installer hangs in Windows 7

2020-08-27 Thread mikkow34ify
poniedziałek, 16 kwietnia 2018 o 10:51:37 UTC+2 jtsh...@gmail.com napisał(a): > On Monday, February 6, 2017 at 10:46:24 AM UTC+5:30, Jean-Claude Roy wrote: > > I am trying to install Python 3.6.0 on a Windows 7 computer. > > The download of 29.1 MB is successful and I get the nextwindow. I choose

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Richard Damon
On 8/27/20 4:31 AM, Chris Green wrote: > While an E-Mail body possibly *shouldn't* have non-ASCII characters in > it one must be able to handle them without errors. In fact haven't > the RFCs changed such that the message body should be 8-bit clean? > Anyway I think the Python 3 mail handling libr

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

2020-08-27 Thread Cameron Simpson
On 27Aug2020 09:16, Chris Green wrote: >Cameron Simpson wrote: >> But note: joining bytes like strings is uncommon, and may indicate >> that >> you should be working in strings to start with. Eg you may want to >> convert popmsg from bytes to str and do a str.join anyway. It depends on >> exactl

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Chris Green
Karsten Hilbert wrote: > > Terry Reedy wrote: > > > On 8/26/2020 11:10 AM, Chris Green wrote: > > > > > > > I have a simple[ish] local mbox mail delivery module as follows:- > > > ... > > > > It has run faultlessly for many years under Python 2. I've now > > > > changed the calling program to Py

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Cameron Simpson
On 27Aug2020 09:31, Chris Green wrote: >I can provoke the error simply by sending myself an E-Mail with >accented characters in it. I'm pretty sure my Linux system is set up >correctly for UTF8 characters, I certainly seem to be able to send and >receive these to others and I even get to see mess

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Peter Otten
Chris Green wrote: > To add a little to this, the problem is definitely when I receive a > message with UTF8 (or at least non-ascci) characters in it. My code > is basically very simple, the main program reads an E-Mail message > received from .forward on its standard input and makes it into an m

Aw: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Karsten Hilbert
> Terry Reedy wrote: > > On 8/26/2020 11:10 AM, Chris Green wrote: > > > > > I have a simple[ish] local mbox mail delivery module as follows:- > > ... > > > It has run faultlessly for many years under Python 2. I've now > > > changed the calling program to Python 3 and while it handles most > > >

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Chris Green
Peter J. Holzer wrote: > The problem is that the message contains a '\ufeff' character (byte > order mark) where email/generator.py expects only ASCII characters. > > I see two possible reasons for this: > > * The mbox writing code assumes that all messages with non-ascii >characters are QP

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Chris Green
Terry Reedy wrote: > On 8/26/2020 11:10 AM, Chris Green wrote: > > > I have a simple[ish] local mbox mail delivery module as follows:- > ... > > It has run faultlessly for many years under Python 2. I've now > > changed the calling program to Python 3 and while it handles most > > E-Mail OK I ha

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

2020-08-27 Thread Chris Green
Cameron Simpson wrote: > On 26Aug2020 15:09, Chris Green wrote: > >2qdxy4rzwzuui...@potatochowder.com wrote: > >> Join bytes objects with a byte object: > >> > >> b"\n".join(popmsg[1]) > > > >Aaahhh! Thank you (and the other reply). > > But note: joining bytes like strings is uncommon, and

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-27 Thread Peter Otten
Samuel Marks wrote: > The main thing I want is type safety. I want Python to complain if the > callee uses the wrong argument types, and to provide suggestions on > what's needed and info about it. > > Without a base class I can just have docstrings and type annotations > to achieve that. > > Wh