Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread Cameron Simpson
On 08Dec2021 23:17, Stefan Ram wrote: > Regexps might have their disadvantages, but when I use them, > it is clearer for me to do all the matching with regexps > instead of mixing them with Python calls like str.isupper. > Therefore, it is helpful for me to have a regexp to match > upper and

Re: Odd locale error that has disappeared on reboot.

2021-12-08 Thread Inada Naoki
On Wed, Dec 8, 2021 at 2:52 AM Chris Green wrote: > > > At 03:40 last night it suddenly started throwing the following error every > time it ran:- > > Fatal Python error: initfsencoding: Unable to get the locale encoding > LookupError: unknown encoding: UTF-8 > > Current thread 0xb6f8d

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread MRAB
On 2021-12-08 23:17, Stefan Ram wrote: Cameron Simpson writes: Instead, consider the \b (word boundary) and \w (word character) markers, which will let you break strings up, and then maybe test the results with str.isupper(). Thanks for your comments, most or all of them are valid, and

[RELEASE] Python 3.11.0a3 is available

2021-12-08 Thread Pablo Galindo Salgado
You can tell that we are slowly getting closer to the first beta as the number of release blockers that we need to fix on every release starts to increase [image: :sweat_smile:] But we did it! Thanks to Steve Dower, Ned Deily, Christian Heimes, Łukasz Langa and Mark Shannon that helped get things r

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread Peter J. Holzer
On 2021-12-09 09:42:07 +1100, Cameron Simpson wrote: > On 08Dec2021 21:41, Stefan Ram wrote: > >Julius Hamilton writes: > >>This is a really simple program which extracts the text from webpages and > >>displays them one sentence at a time. > > > > Our teacher said NLTK will not come up until nex

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread Cameron Simpson
On 08Dec2021 21:41, Stefan Ram wrote: >Julius Hamilton writes: >>This is a really simple program which extracts the text from webpages and >>displays them one sentence at a time. > > Our teacher said NLTK will not come up until next year, so > I tried to do with regexps. It still has bugs, for

Re: Python child process in while True loop blocks parent

2021-12-08 Thread Peter J. Holzer
On 2021-12-08 18:11:48 +0100, Jen Kris via Python-list wrote: > To recap, I'm using a pair of named pipes for IPC between C and > Python.  Python runs as a child process after fork-execv.  The Python > program continues to run concurrently in a while True loop, and > responds to requests from C at

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread Jon Ribbens via Python-list
On 2021-12-08, Julius Hamilton wrote: > 1. The HTML extraction is not perfect. It doesn’t produce as clean text as > I would like. Sometimes random links or tags get left in there. And the > sentences are sometimes randomly broken by newlines. Oh. Leaving tags in suggests you are doing this very

Re: Python child process in while True loop blocks parent

2021-12-08 Thread Cameron Simpson
On 08Dec2021 18:11, Jen Kris wrote: >Python must terminate its write strings with \n, or read will block in >C waiting for something that never comes. There are two aspects to this: - if upstream is rding "lines of text" then you need a newline to terminate the lines - you (probably) should f

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread Cameron Simpson
Assorted remarks inline below: On 08Dec2021 20:39, Julius Hamilton wrote: >deepreader.py: > >import sys >import requests >import html2text >import nltk > >url = sys.argv[1] I might spell this: cmd, url = sys.argv which enforces exactly one argument. And since you don't care about the comm

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread MRAB
On 2021-12-08 19:39, Julius Hamilton wrote: Hey, This is something I have been working on for a very long time. It’s one of the reasons I got into programming at all. I’d really appreciate if people could input some advice on this. This is a really simple program which extracts the text from we

Short, perfect program to read sentences of webpage

2021-12-08 Thread Julius Hamilton
Hey, This is something I have been working on for a very long time. It’s one of the reasons I got into programming at all. I’d really appreciate if people could input some advice on this. This is a really simple program which extracts the text from webpages and displays them one sentence at a tim

Re: python problem

2021-12-08 Thread Mats Wichmann
On 12/8/21 11:18, Larry Warner wrote: I am new at Python. I have installed Python 3.10.1 and the latest Pycharm. When I attempt to execute anything via Pycharm or the command line, I receive a message it can not find Python. I do not know where Python was loaded or where to find and to update PA

Re: How to package a Python command line app?

2021-12-08 Thread Manfred Lotz
Hi Loris, On Wed, 08 Dec 2021 15:38:48 +0100 "Loris Bennett" wrote: > Hi Manfred, > > Manfred Lotz writes: > > > The are many possibilities to package a Python app, and I have to > > admit I am pretty confused. > > > > Here is what I have: > > > > A Python command line app which requires some

Re: How to package a Python command line app?

2021-12-08 Thread Loris Bennett
Hi Manfred, Manfred Lotz writes: > The are many possibilities to package a Python app, and I have to admit > I am pretty confused. > > Here is what I have: > > A Python command line app which requires some packages which are not in > the standard library. > > I am on Linux and like to have an ex

Re: Odd locale error that has disappeared on reboot.

2021-12-08 Thread Chris Green
Julio Di Egidio wrote: > On 07/12/2021 16:28, Chris Green wrote: > > I have a very short Python program that runs on one of my Raspberry > > Pis to collect temperatures from a 1-wire sensor and write them to a > > database:- > > > > #!/usr/bin/python3 > > # > > # > > # read te

How to package a Python command line app?

2021-12-08 Thread Manfred Lotz
The are many possibilities to package a Python app, and I have to admit I am pretty confused. Here is what I have: A Python command line app which requires some packages which are not in the standard library. I am on Linux and like to have an executable (perhaps a zip file with a shebang; whatev

Re: For a hierarchical project, the EXE file generated by "pyinstaller" does not start.

2021-12-08 Thread Mohsen Owzar
Chris Angelico schrieb am Dienstag, 7. Dezember 2021 um 19:16:54 UTC+1: > On Wed, Dec 8, 2021 at 4:49 AM Mohsen Owzar wrote: > > *** > > GPIOContrl.py > > *** > > cla

Re: HTML extraction

2021-12-08 Thread Pieter van Oostrum
Roland Mueller writes: > But isn't bs4 only for SOAP content? > Can bs4 or lxml cope with HTML code that does not comply with XML as the > following fragment? > > A > B > > bs4 can do it, but lxml wants correct XML. Jupyter console 6.4.0 Python 3.9.9 (main, Nov 16 2021, 07:21:43) Type 'copyr

python problem

2021-12-08 Thread Larry Warner
I am new at Python. I have installed Python 3.10.1 and the latest Pycharm. When I attempt to execute anything via Pycharm or the command line, I receive a message it can not find Python. I do not know where Python was loaded or where to find and to update PATH to the program. Larry -- https://ma

Re: Odd locale error that has disappeared on reboot.

2021-12-08 Thread Dieter Maurer
Chris Green wrote at 2021-12-7 15:28 +: >I have a very short Python program that runs on one of my Raspberry >Pis to collect temperatures from a 1-wire sensor and write them to a >database:- > ... >At 03:40 last night it suddenly started throwing the following error every >time it ran:- > >

Re: HTML extraction

2021-12-08 Thread Dieter Maurer
Roland Mueller wrote at 2021-12-7 22:55 +0200: > ... >Can bs4 or lxml cope with HTML code that does not comply with XML as the >following fragment? `lxml` comes with an HTML parser; that can be configured to check loosely. -- https://mail.python.org/mailman/listinfo/python-list

ANN: distlib 0.3.4 released on PyPI

2021-12-08 Thread Vinay Sajip via Python-list
I've recently released version 0.3.4 of distlib on PyPI [1]. For newcomers, distlib is a library of packaging functionality which is intended to be usable as the basis for third-party packaging tools. The main changes in this release are as follows: * Fixed #153: Raise warnings in get_distributio

Re: Python child process in while True loop blocks parent

2021-12-08 Thread Jen Kris via Python-list
I started this post on November 29, and there have been helpful comments since then from Barry Scott, Cameron Simpson, Peter Holzer and Chris Angelico.  Thanks to all of you.  I've found a solution that works for my purpose, and I said earlier that I would post the solution I found. If anyone