Re: Calling Bash Command From Python

2016-10-31 Thread Jon Ribbens
On 2016-10-31, Wildman wrote: > Here is a bash command that I want to run from a python > program: sudo grep "^user\:" /etc/shadow > > If I enter the command directly into a terminal it works > perfectly. If I run it from a python program it returns an > empty string. Below

Re: pip3 : command not found

2016-10-31 Thread Jon Ribbens
On 2016-10-31, Ben Finney wrote: > Instead, you should invoke the exact Python interpreter you want – and, > by extension, the Python environment into which you want packages > installed. > > $ /foo/bar/virtualenv/bin/python3 -m pip install LoremIpsum I'm slightly

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-14 Thread Jon Ribbens
On 2016-12-14, mm0fmf wrote: > On 14/12/2016 02:40, Paul Rubin wrote: >> Skip Montanaro writes: >>> Does the lack of a physical ESC key create problems for people, especially >>> Emacs users? >> >> Not a Mac user and I rarely use ESC instead of ALT

Re: CLP stats: last 500 posts

2016-12-11 Thread Jon Ribbens
On 2016-12-11, Wildman wrote: > I don't think it is a problem with the code but any thoughts > why giganews is not playing nice? Most likely because you're calling XHDR on a header which is not in the server's overview file. --

Re: CLP stats: last 500 posts

2016-12-09 Thread Jon Ribbens
On 2016-12-09, DFS wrote: > import sys as y,nntplib as t,datetime as d > s='' > g=y.argv[1] > n=t.NNTP(s,119,'','') > r,a,b,e,gn=n.group(g) > def printStat(st,hd,rg): > r,d=n.xhdr(st,'%s-%s'%rg) > p=[] > for i in range(len(d)): > v=d[i][1] >

Re: Extended ASCII

2017-01-13 Thread Jon Ribbens
On 2017-01-13, D'Arcy Cain wrote: > I thought I was done with this crap once I moved to 3.x but some > Winblows machines are still sending what some circles call "Extended > ASCII". I have a file that I am trying to read and it is barfing on > some characters. For

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Jon Ribbens
On 2016-12-06, Chris Angelico wrote: > On Tue, Dec 6, 2016 at 10:56 PM, BartC wrote: >> In that directory (which was on Windows but accessible via a virtual Linux), >> typing any Linux command followed by * would have required all 3.4 million >> directory

Re: Recompilation of Python3.6.x

2017-03-22 Thread Jon Ribbens
On 2017-03-22, Thomas Nyberg wrote: > I can't speak for the maintainers, but I don't think that providing such > a list is super reasonable considering that there are many different OSs > which have sometimes have slightly different library package names > (though of course

Re: Recompilation of Python3.6.x

2017-03-22 Thread Jon Ribbens
On 2017-03-22, Grant Edwards <grant.b.edwa...@gmail.com> wrote: > On 2017-03-22, Thomas Nyberg <tomuxi...@gmx.com> wrote: >> On 03/22/2017 03:22 PM, Jon Ribbens wrote: >>> A simple table with a list of the library names, the debian package >>> names, and the

Re: Who are the "spacists"?

2017-03-19 Thread Jon Ribbens
On 2017-03-19, breamore...@gmail.com wrote: > On Sunday, March 19, 2017 at 9:54:52 PM UTC, Larry Hudson wrote: >> A trivial point (and irrelevant)... The thing I find annoying >> about an editor set to expand tabs to spaces is that it takes one >> keypress to indent but

Re: Who are the "spacists"?

2017-03-19 Thread Jon Ribbens
On 2017-03-19, Erik <pyt...@lucidity.plus.com> wrote: > On 19/03/17 22:29, Jon Ribbens wrote: >> Not to mention plenty of editors (e.g. vim) will unindent when you >> press backspace. > > I don't think that's strictly true. If you have just indented with a tab

Re: Who are the "spacists"?

2017-03-18 Thread Jon Ribbens
On 2017-03-18, Grant Edwards wrote: > On 2017-03-18, Mikhail V wrote: >> How would one come to the idea to use spaces for indentation at all? > > Because tabs are a major security vulnerability and should be outlawed > in all source code. You

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Jon Ribbens
On 2017-03-16, Robin Becker wrote: > On 15/03/2017 13:53, Steve D'Aprano wrote: >> You probably can't make a whale fly just by changing the class to bird. It >> will need wings, and feathers, at the very least. > > the whale in the Hitchhiker's Guide found itself flying

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens
New submission from Jon Ribbens: The email module, when creating base64-encoded text parts, does not process line breaks correctly - RFC 2045 s6.8 says that line breaks must be converted to CRLF before base64-encoding, and the email module is not doing this. >>> from email.mime.te

[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread Jon Ribbens
New submission from Jon Ribbens: The email module, when creating text parts using character encoding utf-8, base64-encodes the output even though this is often inappropriate (e.g. if it is a Western language it is almost never appropriate). >>> from email.mime.text import MIMET

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens
Jon Ribbens added the comment: So on further investigation, with the new API and policy=SMTP, it does generate correct base64 output. So I guess on the basis that the new version can generate the right output, and it appears to be a deliberate choice that the default policy breaks the RFCs

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens
Jon Ribbens added the comment: OK cool, but please note that this is a MIME issue not an SMTP issue - if the message has text that is being base64-encoded then it must use CRLF line breaks regardless of whether SMTP is involved

[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread Jon Ribbens
Jon Ribbens added the comment: Just a note for anyone finding this in searching results: it appears that what David means by "python3 API" is actually a new API in Python 3.6 (email.message.EmailMessage). -- ___ Python tr

Re: Pillow ImportError: No module named Image

2017-04-10 Thread Jon Ribbens
On 2017-04-10, jorge.conr...@cptec.inpe.br wrote: > I installed the Pillow in my computer. The I did: > > import Image, ImageMath > > ImportError: No module named Image Try: from PIL import Image, ImageMath --

Re: Test if Script Already Running

2017-04-20 Thread Jon Ribbens
On 2017-04-20, Cameron Simpson wrote: > Others have pointed the way to an exact implementation. > > For myself, I like mkdir. It is portable. It is atomic. It fails if > the target exists. It works over NFS etc. It is easy. > > os.mkdir('lock') > ... do stuff ... >

Re: When will os.remove fail?

2017-03-14 Thread Jon Ribbens
On 2017-03-14, Chris Angelico wrote: >> (The bash rm command will ask you before deleting, but Python's os.remove >> just removes it.) > > (And the rm command won't ask if you say "-f".) rm does not ask before deleting. However some Linux distributions take it upon themselves

Re: When will os.remove fail?

2017-03-14 Thread Jon Ribbens
On 2017-03-14, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Mar 15, 2017 at 12:30 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> rm does not ask before deleting. However some Linux distributions >> take it upon themselves to put "alias rm='

Re: When will os.remove fail?

2017-03-14 Thread Jon Ribbens
On 2017-03-14, Frank Millman wrote: > If I type 'alias' at the console, it lists current aliases. 'root' shows > exactly what Jon quoted above. 'frank' shows no alias for 'rm'. > > I had a quick look to see what was setting it, but there is nothing in > /etc/profile or in

Re: When will os.remove fail?

2017-03-14 Thread Jon Ribbens
On 2017-03-14, Lele Gaifax <l...@metapensiero.it> wrote: > Jon Ribbens <jon+use...@unequivocal.eu> writes: >>>Otherwise, if a file is unwritable, standard input is a terminal, and >>>the -f or --force option is not given, or the -i or --in

Re: Usage of ast.

2017-02-27 Thread Jon Ribbens
On 2017-02-27, Chris Angelico <ros...@gmail.com> wrote: > On Tue, Feb 28, 2017 at 3:58 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> Seeing as most of it is code along the lines of "is this an integer >> constant? if so the value is tha

Re: Who are the "spacists"?

2017-03-21 Thread Jon Ribbens
On 2017-03-21, Michael Torrie wrote: > On 03/21/2017 08:15 AM, Mikhail V wrote: >> Didn't want to say this, but you know it was quite predictable from >> the beginning that the arguments will end up somewhere in "linux >> console is the center of the universe, e-macs is mother

Re: Test if Script Already Running

2017-04-18 Thread Jon Ribbens
On 2017-04-19, Matt wrote: > I have a number of simple scripts I run with cron hourly on Centos > linux. I want the script to check first thing if its already running > and if so exit. > > In perl I did it with this at the start of every script: > > use Fcntl

Re: Battle of the garbage collectors, or ARGGHHHHHH!!!!

2017-04-24 Thread Jon Ribbens
On 2017-04-24, CFK wrote: > Long version: I'm trying to write bindings for python via ctypes to control > a library written in C that uses the bdwgc garbage collector ( > http://www.hboehm.info/gc/). The bindings mostly work, except for when > either bdwgc or python's garbage

Re: Validating regexp

2017-08-10 Thread Jon Ribbens
On 2017-08-10, Cameron Simpson <c...@cskk.id.au> wrote: > On 09Aug2017 10:46, Jon Ribbens <jon+use...@unequivocal.eu> wrote: >>On 2017-08-09, Cameron Simpson <c...@cskk.id.au> wrote: >>> On 08Aug2017 17:31, Jon Ribbens <jon+use...@unequivocal.eu> wrote:

Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-10 Thread Jon Ribbens
On 2017-07-10, John Black wrote: > In article , > jon+use...@unequivocal.eu says... >> On 2017-07-10, John Black wrote: >> > While you're at it, throw these rules in and the group will appear very >> > clean

Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-10 Thread Jon Ribbens
On 2017-07-10, John Black wrote: > While you're at it, throw these rules in and the group will appear very > clean and on topic. > > Subject contains "PEDOFILO" > Or > Subject contains "MAI" > Or > Subject contains "SEGRETO" [snip >100 lines of rules] Or just "subject does not

Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-10 Thread Jon Ribbens
On 2017-07-09, Michael Torrie wrote: > I'm sure Google could filter them if it chose. Behind the group, > though, is the Usenet newsgroup, which is unmoderated and decentralized, > and you can't filter there. ... unless the group were changed to be moderated, which it really

Re: Validating regexp

2017-08-09 Thread Jon Ribbens
On 2017-08-09, Cameron Simpson <c...@cskk.id.au> wrote: > On 08Aug2017 17:31, Jon Ribbens <jon+use...@unequivocal.eu> wrote: >>On 2017-08-08, Chris Angelico <ros...@gmail.com> wrote: >>> On Wed, Aug 9, 2017 at 2:57 AM, Larry Martell <larry.mart...@gm

Re: Validating regexp

2017-08-08 Thread Jon Ribbens
On 2017-08-08, Chris Angelico wrote: > On Wed, Aug 9, 2017 at 2:57 AM, Larry Martell wrote: >> Yeah, it does not throw for 'A|B|' - but mysql chokes on it with empty >> subexpression for regexp' I'd like to flag it before it gets to SQL. > > Okay, so

Re: requests.{get,post} timeout

2017-08-22 Thread Jon Ribbens
On 2017-08-22, Chris Angelico wrote: > The low-level timeout will distinguish between those. If you want a > high-level timeout across the entire job, you can do that too, but > then you have to figure out exactly how long is "too long". Let's say > you set a thirty-second

Re: requests.{get,post} timeout

2017-08-22 Thread Jon Ribbens
On 2017-08-22, Skip Montanaro wrote: > I'm using the requests module with timeouts to fetch URLs, for example: > > response = requests.get("http://www.google.com/;, timeout=10) > > I understand the timeout value in this case applies both to creating the > connection

Re: requests.{get,post} timeout

2017-08-22 Thread Jon Ribbens
On 2017-08-22, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Aug 23, 2017 at 2:58 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> Yes. There is no timeout feature that can be used to limit the total >> time a 'requests' request takes. Some people might t

Re: requests.{get,post} timeout

2017-08-23 Thread Jon Ribbens
On 2017-08-22, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Aug 23, 2017 at 5:06 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> I have no idea what you mean here. The only sane way to implement the >> request timeout is to provide both types of timeo

Re: requests.{get,post} timeout

2017-08-23 Thread Jon Ribbens
On 2017-08-23, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Aug 23, 2017 at 9:10 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> I am interested to learn what you mean by "with a thread". How would >> one execute a requests, er, r

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Jon Ribbens
On 2017-05-28, Bill Deegan wrote: > As a follow up to a discussion on IRC #python channel today. > > Assuming the same order of insertions of the same items to a dictionary > would the iteration of a dictionary be the same (not as the order of > insertion, just from run

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Jon Ribbens
On 2017-05-28, Steve D'Aprano wrote: > What exactly did you think I got wrong? 3.6 does preserve the dict order. It isn't a guarantee so may change in future versions, but it is what 3.6 actually does. >> If you're asking "given a fixed Python version, and where

Re: How to `eval` code with `def`?

2017-05-28 Thread Jon Ribbens
On 2017-05-29, Peng Yu wrote: > I got the following error when I try to eval the following code with > def. Does anybody know what is the correct way to evaluation python > code that contains `def`? Thanks. exec -- https://mail.python.org/mailman/listinfo/python-list

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Jon Ribbens
On 2017-05-30, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Tue, 30 May 2017 15:12:55 -0000 (UTC), Jon Ribbens ><jon+use...@unequivocal.eu> declaimed the following: >>I can't make head nor tail of what they are trying to say there. >>Mind you, it doesn'

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Jon Ribbens
On 2017-05-30, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Tue, May 30, 2017 at 1:27 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: > A cursor is just a control structure for traversing over a result set. Exactly - so it makes no sense at all to have one when t

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Jon Ribbens
On 2017-05-30, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Tue, 30 May 2017 13:42:14 -0000 (UTC), Jon Ribbens ><jon+use...@unequivocal.eu> declaimed the following: >>On 2017-05-30, Skip Montanaro <skip.montan...@gmail.com> wrote: >>> Assuming the un

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Jon Ribbens
On 2017-05-30, Skip Montanaro wrote: > Assuming the underlying database supports transactions, is there any > difference between calling the commit() method on the connection and > calling the execute method on the cursor with the "commit transaction" > statement? It

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Jon Ribbens
On 2017-05-30, Joseph L. Casale wrote: >> There's no difference I'm aware of in the implementations I've used, >> but having a consistent API does allow for constructions such as: >> >> try: >> do_stuff(conn) >> except: >> conn.rollback() >> finally: >>

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Skip Montanaro wrote: > I'm kind of stuck with the database API I have. ("Love the child you > have, not the one you wish you had?") Given that I have the choice to > execute those three statements to bound a transaction, is there any > reason not to use

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: >> You would do: >> >> cur.execute("SELECT ...") >> for row1 in cur.fetchall(): >> cur.execute("SELECT ...") >> for row2 in cur.

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, May 31, 2017 at 4:26 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> Baloney yourself - I didn't say it was a *new* connection. In DB-API, >> a Connection is basically nothi

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-02 Thread Jon Ribbens
On 2017-06-02, Frank Millman wrote: > "Frank Millman" wrote in message news:ogr3ff$sg1$1...@blaine.gmane.org... > >> By default, psycopg2 uses 'autocommit', which means that even a SELECT is >> preceded by a 'BEGIN' statement internally. I never changed the default, so >> all

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-02 Thread Jon Ribbens
On 2017-06-02, Dennis Lee Bieber wrote: > Connector/Python (MySQL) [guess it is time for me to finally upgrade to > Python 3.x -- it was the delay in getting mysqldb ported that held me back] > does allow for turning on autocommit -- which is documented as issuing an

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-02 Thread Jon Ribbens
On 2017-06-02, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Jun 3, 2017 at 2:45 AM, Jon Ribbens <jon+use...@unequivocal.eu> wrote: >> Bewaare - MyISAM tables have no transactions for DML but they do have >> transactions for DDL. Insane but true. > >

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-03 Thread Jon Ribbens
On 2017-06-02, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Jun 3, 2017 at 5:31 AM, Jon Ribbens <jon+use...@unequivocal.eu> wrote: >> I'm not saying that transactional DDL is insane (it isn't), but MyISAM >> tables having transactions *only* for DDL is... sur

Re: Openpyxl cell format

2017-06-05 Thread Jon Ribbens
On 2017-06-05, Mahmood Naderan wrote: > Maybe... But specifically in my case, the excel file is exported > from a web page. I think there should be a way to read the content > as a pure text. I have a vague memory that Excel stores dates as integers, so if you were to read

Re: Python DB API - commit() v. execute("commit transaction")?

2017-06-01 Thread Jon Ribbens
On 2017-06-01, Gregory Ewing wrote: > Is there any serious work being done on a DB API 3.0? > If there is, I'd be interested in helping with the design. There are a bunch of existing APIs in other languages that can easily be copied ;-) The good news is of course

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Tue, May 30, 2017 at 4:57 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> A DB-API "cursor" is a database connection > > Baloney. Creating a cursor does not spawn a new connection

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, DFS <nos...@dfs.com> wrote: > On 5/31/2017 6:26 AM, Jon Ribbens wrote: >> Yes, this is indeed a problem with DB-API - you have to keep *two* >> objects around all the time (the connection and the cursor) and pass >> them to functions, etc, when in any sen

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: >> Indeed. I think this would not work, in general. For example, I think >> with MySQLdb it would work if you use a standard Cursor class, as that >> downloads the entire result set as

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Pavol Lisy wrote: > But althoug return from execute is undefined ( > https://www.python.org/dev/peps/pep-0249/#id16 ), you could iterate > over cursor ( https://www.python.org/dev/peps/pep-0249/#iter ) ... which is also optional. --

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Chris Angelico <ros...@gmail.com> wrote: > On Thu, Jun 1, 2017 at 12:10 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> ... unless you want to call .commit() or .rollback(). >> Which is where we came in. > > Techni

Re: Unhelpful error message

2017-06-06 Thread Jon Ribbens
On 2017-06-06, Peter Otten <__pete...@web.de> wrote: > ...but not the empty string: > float("") > Traceback (most recent call last): > File "", line 1, in > ValueError: could not convert string to float: > > Maybe there were some backward compatibility concerns that I lack the > fantasy

Re: Unhelpful error message

2017-06-06 Thread Jon Ribbens
On 2017-06-06, Thomas Nyberg <tomuxi...@gmx.com> wrote: > On 06/06/2017 11:46 AM, Jon Ribbens wrote: >> On 2017-06-06, Thomas Nyberg <tomuxi...@gmx.com> wrote: >>> My changes feel a bit hacky. I wanted to just drop a straight repr() in, >>> but I didn't w

Re: Unhelpful error message

2017-06-06 Thread Jon Ribbens
On 2017-06-06, Thomas Nyberg wrote: > My changes feel a bit hacky. I wanted to just drop a straight repr() in, > but I didn't want to change the code too much since I assume the string > formatting is already there for a reason (e.g. "%.200s"). Just change the '%.200s' to

Re: requests.{get,post} timeout

2017-08-24 Thread Jon Ribbens
On 2017-08-23, Chris Angelico <ros...@gmail.com> wrote: > On Thu, Aug 24, 2017 at 8:54 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> On 2017-08-23, Chris Angelico <ros...@gmail.com> wrote: >>> Yes and no. If requests provided a 'cancel q

Re: requests.{get,post} timeout

2017-08-24 Thread Jon Ribbens
On 2017-08-24, Chris Angelico <ros...@gmail.com> wrote: > On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> Where did you explain how it can be done without help? As far as I'm >> aware, you can't close the socket without help

Re: requests.{get,post} timeout

2017-08-24 Thread Jon Ribbens
On 2017-08-24, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Aug 25, 2017 at 12:17 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> On 2017-08-24, Chris Angelico <ros...@gmail.com> wrote: >>> On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens

Re: requests.{get,post} timeout

2017-08-25 Thread Jon Ribbens
On 2017-08-25, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Aug 26, 2017 at 1:47 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> On 2017-08-25, Chris Angelico <ros...@gmail.com> wrote: >>> That looks like an exception to me. Not a "

Re: requests.{get,post} timeout

2017-08-25 Thread Jon Ribbens
On 2017-08-25, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Aug 26, 2017 at 5:40 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> On 2017-08-25, Chris Angelico <ros...@gmail.com> wrote: >>> On Sat, Aug 26, 2017 at 1:47 AM, Jon Ribbens

Re: requests.{get,post} timeout

2017-08-25 Thread Jon Ribbens
On 2017-08-25, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Aug 26, 2017 at 6:16 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> I said it in the majority of the posts I've made in this thread. >> I said it in the post you were responding to just now.

Re: requests.{get,post} timeout

2017-08-23 Thread Jon Ribbens
On 2017-08-23, Chris Angelico wrote: > Yes and no. If requests provided a 'cancel query' feature, it would > play nicely with everything else, but (a) the entire concept here is > that the request has stalled, so you COULD just ignore the pending > query and pretend it's failed

Re: requests.{get,post} timeout

2017-08-23 Thread Jon Ribbens
On 2017-08-23, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Aug 23, 2017 at 10:52 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> Yes, what I was interested to learn was how the monitoring thread can >> "cut off" the requesting thread. &g

Re: requests.{get,post} timeout

2017-08-25 Thread Jon Ribbens
On 2017-08-25, Chris Angelico wrote: > That looks like an exception to me. Not a "process is now terminated". > That's what happened when I pressed Ctrl-C (the IP address was > deliberately picked as one that doesn't currently exist on my network, > so it took time). Ok yes, so

Re: requests.{get,post} timeout

2017-08-25 Thread Jon Ribbens
On 2017-08-25, dieter wrote: > This may no longer work. Long ago, I have often been plagued > by such EINTR exceptions, and I have wished heavily that in those > cases the IO operation should be automatically resumed. In recent time, > I have no longer seen such exceptions -

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Jon Ribbens
On 2017-10-12, Ben Bacarisse wrote: > Chris Angelico writes: >> Normally, with a Python-based framework, you don't need _any_ web >> server configuration. You simply define your URL routing within the >> Python code. The only thing the web server needs to

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Jon Ribbens
On 2017-10-12, Ben Bacarisse wrote: > I see. If I'm reading this right, the app requests are passed through > to another server -- uWSGI. Yes. It doesn't have to be uWSGI; it could be gunicorn, or you could probably use Apache's mod_fcgid. As a last resort you could use

Re: reading text in pdf, some working sample code

2017-11-22 Thread Jon Ribbens
On 2017-11-21, Daniel Gross wrote: > I am new to python and jumped right into trying to read out (english) text > from PDF files. That's not a trivial task. However I just released pycpdf, which might help you out. Check out https://github.com/jribbens/pycpdf which shows an

Re: Finding the module object in Python 3 C extensions (Posting On Python-List Prohibited)

2017-11-23 Thread Jon Ribbens
On 2017-11-23, Lawrence D’Oliveiro <lawrenced...@gmail.com> wrote: > On Thursday, November 23, 2017 at 4:03:18 AM UTC+13, Jon Ribbens wrote: >> In Python 3, you are supposed to store the global state in an >> allocated memory area instead. > > Says who? Con

Finding the module object in Python 3 C extensions

2017-11-22 Thread Jon Ribbens
In Python 2, a C extension module's global state was stored in global variables. This obviously means the state is trivially accessible to all code in the module. In Python 3, you are supposed to store the global state in an allocated memory area instead. For functions defined directly under the

Re: Repeated Names (Repeated Names)

2017-12-17 Thread Jon Ribbens
On 2017-12-17, Tim Golden wrote: > On 17/12/17 00:10, Gregory Ewing wrote: >> The duplicate posts all seem to have this header: >> >> Injection-Info: news.bbs.geek.nz; >> posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E"; >> logging-data="4415";

Re: request fails on wikipedia (https) - certificate verify failed (Posting On Python-List Prohibited)

2017-12-13 Thread Jon Ribbens
On 2017-12-13, Lawrence D’Oliveiro <lawrenced...@gmail.com> wrote: > On Wednesday, December 13, 2017 at 10:17:15 AM UTC+13, Jon Ribbens wrote: >> Try `pip install certifi` > > It really is preferable to install standard distro packages where available, > rather than res

Re: request fails on wikipedia (https) - certificate verify failed (Posting On Python-List Prohibited)

2017-12-13 Thread Jon Ribbens
On 2017-12-13, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Dec 13, 2017 at 10:38 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> On 2017-12-13, Lawrence D’Oliveiro <lawrenced...@gmail.com> wrote: >>> On Wednesday, December 13, 2017 at 10:17:15

Re: request fails on wikipedia (https) - certificate verify failed (_ss

2017-12-13 Thread Jon Ribbens
On 2017-12-11, F Massion <fmass...@web.de> wrote: > Am Dienstag, 12. Dezember 2017 14:33:42 UTC+1 schrieb Jon Ribbens: >> On 2017-12-11, F Massion <fmass...@web.de> wrote: >> > ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed > (_ssl.c:74

Re: Repeated Names (Repeated Names)

2017-12-18 Thread Jon Ribbens
On 2017-12-17, Skip Montanaro wrote: >>> I've emailed the administrator of bbs.geek.nz, maybe he >>> will be able to stop it. >> >> Thanks, Greg. We're actually blocking via that and related headers at >> the gateway, which is why the mailing list is no longer seeing the

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Alexey Muranov wrote: > 'Then' describes what happens next indeed, unless some extraordinary > situation prevents it from happening, for example: > > try: > go_to_the_bakery() > then: > buy_croissants(2) > except BakeryClosed:

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Fri, 3 Nov 2017 03:31 am, Jon Ribbens wrote: >> No, it's an obvious bug. You have a 'for...else' with no 'break'. >> Like I said, that should probably be a syntax error. > > It should absolutely not

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >>> It should absolutely not be a syntax error. There's no reason for it >>> to be a syntax error, except to satisf

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Steve D'Aprano wrote: > The for loop does not necessarily perform a search: > > count = 1 > for obj in sequence: > if count > MAX_OBJECTS: > print("too many objects, halting") > break > process(obj) > else: > print("finished")

Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Jon Ribbens
On 2017-11-04, Michael Torrie wrote: > On 11/03/2017 09:06 PM, Chris Angelico wrote: >> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote: >>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote: That's incorrect. There are multiple ways to exit a loop that

Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-04 Thread Jon Ribbens
On 2017-11-04, Ben Finney wrote: > To respond to the criticism of an idea – criticism containing no mention > of the person – as though it “clearly refers to the [person]”, is of > significant concern on a software dicussion forum such as this. No, the thing that is

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Jon Ribbens
On 2017-11-05, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote: >> That conforms to my model. It's searching for the condition >> 'count > MAX_OBJECTS'. > > That's sounds to me that you are willing to call just a

Re: replacing `else` with `then` in `for` and `try`

2017-11-05 Thread Jon Ribbens
On 2017-11-05, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Jon Ribbens <jon+use...@unequivocal.eu> writes: >> I've provided you with a way of thinking about 'for...else' that makes >> its purpose and meaning intuitively obvious. > > I've read that sentence

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Jon Ribbens
On 2017-11-06, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Jon Ribbens <jon+use...@unequivocal.eu> writes: >> On 2017-11-05, Ben Finney <ben+pyt...@benfinney.id.au> wrote: >> > Jon Ribbens <jon+use...@unequivocal.eu> writes: >> >> I've

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Jon Ribbens
On 2017-11-02, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Fri, 3 Nov 2017 12:39 am, Jon Ribbens wrote: >> Why would we want to make the language worse? It is fairly obvious >> what 'else' means, > > Yes, obvious and WRONG. Nope, obvious and right. > fo

Re: Ideas about how software should behave

2017-11-08 Thread Jon Ribbens
On 2017-11-08, Ben Finney wrote: > I also think Jon had cause to bristle somewhat at the characterisation. > I don't think Jon was attacked by Steve's remark, but I do sympathise > with the instinct to feel a criticism as an attack. Steve called me arrogant, that's an

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Jon Ribbens
On 2017-11-01, Alexey Muranov wrote: > what do you think about the idea of replacing "`else`" with "`then`" in > the contexts of `for` and `try`? > > It seems clear that it should be rather "then" than "else." Compare > also "try ... then ... finally" with "try ...

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Jon Ribbens
On 2017-11-06, Chris Angelico wrote: > If you start with the assumption that "intuitively obvious" doesn't > actually mean "intuitively obvious" but actually means something > completely different, then your statement definitely means something > non-contradictory. But if you

Re: request fails on wikipedia (https) - certificate verify failed (_ssl.c:748)

2017-12-12 Thread Jon Ribbens
On 2017-12-11, F Massion wrote: > ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed > (_ssl.c:748) Try `pip install certifi` -- https://mail.python.org/mailman/listinfo/python-list

Re: Report on non-breaking spaces in posts (was: How to join elements at the beginning and end of the list)

2017-10-31 Thread Jon Ribbens
On 2017-10-31, Stefan Ram wrote: > Ned Batchelder writes: >>     def wrapped_join(values, sep): > > Ok, here's a report on me seing non-breaking spaces in > posts in this NG. I have written this report so that you > can see that it's not

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread Jon Ribbens
On 2018-05-10, Skip Montanaro wrote: >> I wonder why someone would take a feature generally agreed to be a >> poorly designed feature of C, and incorporate it into a new language. > > I think you might be looking at a decision made in the late 1980s through a > pair of

<    1   2   3   4   5   6   7   >