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 know is where to >> find the web app, and

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 CGI, which wouldn't invol

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 my newsreader that is converting > something, b

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 ... else ... finally". > > Curren

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

2017-11-02 Thread Jon Ribbens
On 2017-11-02, Steve D'Aprano 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. > for x in seq: >

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

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

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Steve D'Aprano 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 be

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

2017-11-03 Thread Jon Ribbens
On 2017-11-03, Chris Angelico wrote: > On Fri, Nov 3, 2017 at 10:49 PM, Jon Ribbens > wrote: >>> It should absolutely not be a syntax error. There's no reason for it >>> to be a syntax error, except to satisfy some arrogant and foolish >>> idea of purity

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") > > According to your mental

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 will prevent the `else` block fro

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 "of significant conern on a so

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

2017-11-05 Thread Jon Ribbens
On 2017-11-05, Steve D'Aprano 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 about any

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

2017-11-05 Thread Jon Ribbens
On 2017-11-05, Ben Finney wrote: > Jon Ribbens 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 several times, and I still can't make it

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

2017-11-06 Thread Jon Ribbens
On 2017-11-06, Ben Finney wrote: > Jon Ribbens writes: >> On 2017-11-05, Ben Finney wrote: >> > Jon Ribbens writes: >> >> I've provided you with a way of thinking about 'for...else' that makes >> >> its purpose and meaning intuitively

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 start with the assump

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 attack - never mind that he

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 m

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 example of extracting

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 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? Considering that this > <https://

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: 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 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 resort to pip: > > sudo

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

2017-12-13 Thread Jon Ribbens
On 2017-12-11, F Massion wrote: > Am Dienstag, 12. Dezember 2017 14:33:42 UTC+1 schrieb 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`

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 wrote: > On Wed, Dec 13, 2017 at 10:38 PM, Jon Ribbens > wrote: >> On 2017-12-13, Lawrence D’Oliveiro wrote: >>> On Wednesday, December 13, 2017 at 10:17:15 AM UTC+13, Jon Ribbens wrote: >>>> Try `pip install certifi` >>&

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"; mail-complaints-to="ab...@news.bbs.g

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 >> duplicates. I'm not sur

Re: requests / SSL blocks forever?

2018-01-13 Thread Jon Ribbens
On 2018-01-13, Nagy László Zsolt wrote: > I have a multi threaded Windows service written in Python. It is running > on 3.6.2.  Sometimes I cannot stop the service, because on of the > threads won't exit. I have narrowed down the problem to request and > _lib.SSL_read. (a) are you setting daemon=

Re: requests / SSL blocks forever?

2018-01-15 Thread Jon Ribbens
On 2018-01-15, Nagy László Zsolt wrote: >> In other words: if the server starts to send the response, but then >> stops sending it (without closing the connection), then this will block >> forever anyway. > Or maybe I misunderstood the docs and the timeout means the max. time > elapsed between rec

Re: Right way to io.open(...) an existing file object in Python 2.7?

2018-01-16 Thread Jon Ribbens
On 2018-01-16, Skip Montanaro wrote: > I'd like to take advantage of the seekable() method of io.IOBase with > existing open file objects, especially the standard in/out/err file > objects. If it's difficult to imagine a circumstance in which you would want to seek on stdio/out/err where you were

Re: documentation on read.encode

2018-01-16 Thread Jon Ribbens
On 2018-01-16, Larry Martell wrote: > Yeah I saw it mentioned in a SO post that was java related. Wondering > if there is some way to do the same in python. base64.b64encode(foo) -- https://mail.python.org/mailman/listinfo/python-list

Re: JSON confusion

2016-08-17 Thread Jon Ribbens
On 2016-08-17, Steve Simmons wrote: > I'm trying to write a small utility to find the closest railway station > to a given (UK) postcode but the result is in JSON and I'm not familiar > with it. I've got as far as extracting the JSON object and I can print > the first level elements ("success"

Re: index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread Jon Ribbens
On 2016-08-19, iMath wrote: > for > regex.search(string[, pos[, endpos]]) > The optional parameter endpos is the index into the string beyond > which the RE engine will not go, while this lead me to believe the > RE engine will still search on till the endpos position even after > it returned the

Re: saving octet-stream png file

2016-08-21 Thread Jon Ribbens
On 2016-08-19, Larry Martell wrote: > fd.write(request.POST[key]) You could try: request.encoding = "iso-8859-1" fd.write(request.POST[key].encode("iso-8859-1")) It's hacky and nasty and there might be a better "official" method but I think it should work. -- https://mail.python.org/mailma

Re: Does This Scare You?

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Steve D'Aprano wrote: > On Mon, 22 Aug 2016 10:38 am, eryk sun wrote: >> To me it's scary that this check misses cases because it's trying to >> be cross-platform instead of simply relying on GetFullPathName to do >> the work. For example, it misses at least the following cases: > >

Re: Does This Scare You?

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Chris Angelico wrote: > On Mon, Aug 22, 2016 at 8:33 PM, Jon Ribbens > wrote: >> On 2016-08-22, Steve D'Aprano wrote: >>> On Mon, 22 Aug 2016 10:38 am, eryk sun wrote: >>>> To me it's scary that this check misses cases because it&#x

Re: Does This Scare You?

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Chris Angelico wrote: > I tried things like "con.txt" and it simply failed (no such file or > directory), without printing anything to the console. I'm not sure how you got that to fail, but writing to "con.txt" certainly does write to the console in Windows 10 - I just tried it:

Re: saving octet-stream png file

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Larry Martell wrote: > On Sun, Aug 21, 2016 at 5:24 PM, Jon Ribbens > wrote: >> On 2016-08-19, Larry Martell wrote: >>> fd.write(request.POST[key]) >> >> You could try: >> >> request.encoding = "iso-8859-1" >> fd.w

Re: Does This Scare You?

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Steve D'Aprano wrote: > On Mon, 22 Aug 2016 09:50 pm, Jon Ribbens wrote: >> I don't know what purpose you are envisaging this function being used >> for, but the only one I can think of is input sanitisation. e.g. a web >> form where you receive a f

Re: Does This Scare You?

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Steve D'Aprano wrote: > I'm not really sure what the question is -- we've established that there's a > bug in the non-Windows implementation that tries to emulate Window's > behaviour. What else is there to argue about? It doesn't seem to be "the non-Windows implementation", it see

Re: saving octet-stream png file

2016-08-22 Thread Jon Ribbens
On 2016-08-22, Larry Martell wrote: > On Mon, Aug 22, 2016 at 1:25 PM, Jon Ribbens > wrote: >> On 2016-08-22, Larry Martell wrote: >>> (Pdb) type(request.POST[key]) >>> >>> (Pdb) request.encoding = "iso-8859-1" >>> (Pdb) type(reque

Re: Does This Scare You?

2016-08-26 Thread Jon Ribbens
On 2016-08-24, Chris Angelico wrote: > On Thu, Aug 25, 2016 at 7:00 AM, eryk sun wrote: >> I discovered why "Logs/con.txt" isn't working right in Windows 7, >> while "Logs/nul.txt" does get redirected correctly to r"\\.\nul". >> Prior to Windows 8 the console doesn't use an NT device, so the base

Re: Any ReST aware editors?

2016-09-22 Thread Jon Ribbens
On 2016-09-22, Steve D'Aprano wrote: > I have editors which will use syntax highlighting on .rst files, but I'm > hoping for something a bit smarter. > > What I'd like is an editor with a split window, one side showing the rst > that I can edit, the other side showing the formatted text updated as

Re: Any ReST aware editors?

2016-09-22 Thread Jon Ribbens
On 2016-09-22, Yann Kaiser wrote: > On Thu, Sep 22, 2016, 12:59 Jon Ribbens wrote: >> On 2016-09-22, Steve D'Aprano wrote: >> > I have editors which will use syntax highlighting on .rst files, but I'm >> > hoping for something a bit smarter. >> >

Re: Generator comprehension - list None

2016-10-18 Thread Jon Ribbens
On 2016-10-18, Steve D'Aprano wrote: > On Tue, 18 Oct 2016 10:43 pm, Sayth Renshaw wrote: >> I was solving a problem to create a generator comprehension with 'Got ' >> and a number for each in range 10. >> >> This I did however I also get a list of None. I don't understand where >> none comes fro

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jon Ribbens
On 2016-10-23, Jon Ribbens wrote: > On 2016-10-23, Jason Friedman wrote: >>> >>> for message in mailbox.mbox(sys.argv[1]): >>> if message.has_key("From") and message.has_key("To"): >>> addrs = message.get_all(&

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jon Ribbens
On 2016-10-23, Jason Friedman wrote: >> >> for message in mailbox.mbox(sys.argv[1]): >> if message.has_key("From") and message.has_key("To"): >> addrs = message.get_all("From") >> addrs.extend(message.get_all("To")) >> for addr in addrs: >>

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 is the code I am usi

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 curious about that. /foo/bar

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-10-31, Steve D'Aprano wrote: > On Mon, 31 Oct 2016 07:21 pm, Jon Ribbens wrote: >> 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

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-11-05, Steve D'Aprano wrote: > Your implied question here: > >> Maybe he meant what you are saying, I don't know, but >> it isn't what he wrote. He clearly implied that you can run Python >> in the context of a virtualenv by just invoking that virtualenv's >> local Python without running

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-11-05, Steve D'Aprano wrote: > On Sun, 6 Nov 2016 02:55 am, Jon Ribbens wrote: >> I'm afraid I can only suggest that you try re-reading the subthread >> again until you manage to understand it. It wasn't really that >> complicated but you seem to hav

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-11-06, Steve D'Aprano wrote: > *plonk* Thank feck for that, I was beginning to think he'd never shut up. I don't suppose anyone else more constructive and informed actually knows the answer to my rather simple question of how Python knows it's in a venv? ;-) -- https://mail.python.org/m

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-11-06, Chris Angelico wrote: > On Sun, Nov 6, 2016 at 3:03 PM, Jon Ribbens wrote: >> I don't suppose anyone else more constructive and informed actually >> knows the answer to my rather simple question of how Python knows >> it's in a venv? ;-) >

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-11-06, Ben Finney wrote: > Jon Ribbens writes: >> On 2016-11-06, Steve D'Aprano wrote: >> > *plonk* >> >> Thank feck for that, I was beginning to think he'd never shut up. > > Really? I didn't see a single message from Steven that wasn

Re: pip3 : command not found

2016-11-05 Thread Jon Ribbens
On 2016-11-06, Ben Finney wrote: > Jon Ribbens writes: > >> He […] lied about me "not arguing in good faith" > > I find you to be not arguing in good faith; I find that to be particularly pompous of you. I am arguing in good faith regardless of your misguided opin

Re: pip3 : command not found

2016-11-06 Thread Jon Ribbens
On 2016-11-06, Chris Angelico wrote: > On Sun, Nov 6, 2016 at 4:27 PM, Jon Ribbens wrote: >>> 2) If Python notices that its executable comes from a venv, it uses it. >> >> Yes. My question is *how does it notice*? > > I could answer this question, but since you don&

Re: pip3 : command not found

2016-11-06 Thread Jon Ribbens
On 2016-11-06, Michael Torrie wrote: > I'm guessing that it notices by examining the path it was launched from > and looks for virtual environment files relative to that path. Indeed, the mysterious thing is what are "virtual environment files"? The official docs say "A venv is a directory tree w

Re: Python String Handling

2016-11-12 Thread Jon Ribbens
On 2016-11-12, subhabangal...@gmail.com wrote: > I am restating the problem. > > "Hello my name is Richard" > > is a string. > > I have tagged the words Hello and Richard > as "Hello/Hi" and "Richard/P". > After this I could get the string as a list of words > as in, > ['Hello/Hi','my','name','

Re: Guido? Where are you?

2016-11-22 Thread Jon Ribbens
On 2016-11-22, Gilmeh Serda wrote: > On Mon, 21 Nov 2016 00:53:33 -0800, Ethan Furman wrote: >> Unfortunately, we do not have any control over the comp.lang.python >> newsgroup > > Gee, "unfortunately"? Really!? Gosh! I'm glad I don't have to live > anywhere close to you. 8·[ > > NOBODY "owns" th

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 entries to be accessed in order to build

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] > if st=='Su

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. -- https://mail.python.org/mailman/listinfo/python-list

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 while editing with >> Emacs on a local computer,

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 example: > >due to the Q

Re: Is Python SSL API thread-safe?

2017-01-22 Thread Jon Ribbens
On 2017-01-22, Grant Edwards wrote: > Is the Python SSL API thread-safe with respect to recv() and send()? > > IOW, can I have one thread doing blocking recv() calls on an SSL > connection object while "simultaneously" a second thread is calling > send() on that same connection object? I think th

Re: How coding in Python is bad for you

2017-01-23 Thread Jon Ribbens
On 2017-01-23, alister wrote: > On Tue, 24 Jan 2017 07:19:42 +1100, Chris Angelico wrote: >> I believe that's "bad for you" in the sense that chocolate is bad for >> you. >> >> It isn't. > > chocolate is a poison (lethal dose for a human approx 22lb) That's a meaningless statement. *Everything*

Re: How coding in Python is bad for you

2017-01-24 Thread Jon Ribbens
On 2017-01-24, alister wrote: > On Mon, 23 Jan 2017 20:39:26 +0000, Jon Ribbens wrote: >> That's a meaningless statement. *Everything* is a poison in sufficient >> quantities. > > indees when I here someone saying "I won't have any xyz because they have >

Re: Need reviews for my book on introductory python

2017-01-27 Thread Jon Ribbens
On 2017-01-27, D'Arcy Cain wrote: > On 2017-01-27 03:17 PM, bob gailer wrote: >> sudo apt-get won't work on Windows. Tell the reader that this is how to >> do it in Unix, and show the Windows equivalent. > > Actually it doesn't work on Unix either. It only works on Linux. Actually it doesn't wor

Re: Rename file without overwriting existing files

2017-01-30 Thread Jon Ribbens
On 2017-01-30, Jussi Piitulainen wrote: > It doesn't seem to be documented. I looked at help(os.link) on Python > 3.4 and the corresponding current library documentation on the web. I > saw no mention of what happens when dst exists already. > > Also, creating a hard link doesn't seem to work betw

Re: Rename file without overwriting existing files

2017-01-30 Thread Jon Ribbens
On 2017-01-30, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: >> A lot of the functions of the 'os' module do nothing but call the >> underlying OS system call with the same name. It would not only be >> redundant to copy the OS documentation into

Re: Rename file without overwriting existing files

2017-01-30 Thread Jon Ribbens
On 2017-01-30, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: >> On 2017-01-30, Peter Otten <__pete...@web.de> wrote: >>> However, the current Python version of link() is sufficiently different >>> from >>><https://linux.die.net

Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-18 Thread Jon Ribbens
Going live with the new site while its search function is mostly inoperative seems a bit brave. https://github.com/pypa/warehouse/issues/3746 On 2018-04-18, Noah wrote: > Awesome > > On Mon, Apr 16, 2018 at 8:21 PM, Laura Hampton > wrote: > >> New PyPI launched, legacy PyPI shutting dow

Re: please test the new PyPI (now in beta)

2018-04-18 Thread Jon Ribbens
On 2018-03-27, Chris Angelico wrote: > Any time you see something that requires JavaScript for this, you know > you've found a web site that dates back to... uhh, actually I don't > know. I only have versioning info on MDN back as far as HTML 4.01 ergo > 1999, and the placeholder attribute is ther

Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-19 Thread Jon Ribbens
On 2018-04-18, Tony van der Hoff wrote: > On 18/04/18 13:15, Zbigniew Jędrzejewski-Szmek wrote: >> On Mon, Apr 16, 2018 at 01:21:50PM -0400, Laura Hampton wrote: >>> New PyPI launched, legacy PyPI shutting down April 30[1] >>> >>> Starting today, the canonical Python Package Index is at >>> http

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 glasses made in 2018. > > As

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

2018-05-11 Thread Jon Ribbens
On 2018-05-10, Chris Angelico wrote: > On Fri, May 11, 2018 at 5:04 AM, Jon Ribbens > wrote: >> This whole thread is reminding me PHP 2, which would magically treat >> the second parameter of ChMod() as octal, because clearly if weak >> typing is good then *no* ty

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

2018-05-11 Thread Jon Ribbens
On 2018-05-11, Grant Edwards wrote: > On 2018-05-11, Gene Heskett wrote: >> Computers haven't read a single 8 bit byte in years, some reading >> 128 or 256 bits in a single read cycle today. > > Nonsense. All modern CPUs that I'm aware of still still support > single byte reads, and compilers st

Re: urllib3 1.23 breaks API

2018-06-06 Thread Jon Ribbens
On 2018-06-06, Cecil Westerhof wrote: > I had installed urllib3 1.22 for Python3. I upgraded it to 1.23. This > broke the requirements for requests 2.18.4: > requests 2.18.4 has requirement urllib3<1.23,>=1.21.1, but you'll have > urllib3 1.23 which is incompatible > > I downgraded to 1.22, b

Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Jon Ribbens
On 2018-06-08, Chris Angelico wrote: > Yes, this is true. It's not copyright that is unenforceable, but the > copyright notice in his message. Nobody is denying that he owns his > own words; but by posting them on a public forum, he - like everyone > else here - is implicitly granting us the right

Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Jon Ribbens
On 2018-06-10, Ben Bacarisse wrote: > Jon Ribbens writes: > >> I'd suggest that since the processes he's purporting to disallow are >> entirely standard and automated and he knows full well they exist and >> that there is no mechanism by which they could be aff

Re: Reading EmailMessage from file

2018-07-15 Thread Jon Ribbens
On 2018-07-15, Skip Montanaro wrote: > I have an email message in a file (see attached). Attachments don't work here. > something like this should construct an email message from the file: > from email.message import EmailMessage msg = EmailMessage() fp = open("/home/skip/tmp/7948

Re: Users banned

2018-07-15 Thread Jon Ribbens
On 2018-07-15, Chris Angelico wrote: > On Mon, Jul 16, 2018 at 7:35 AM, Marko Rauhamaa wrote: >> Christian Gollwitzer : >>> Am 15.07.18 um 19:25 schrieb Ethan Furman: The following users are now banned from Python List: ... BartC >>> >>> I don't really think that this is appropriat

Re: Reading EmailMessage from file

2018-07-16 Thread Jon Ribbens
On 2018-07-16, Skip Montanaro wrote: >> What are you actually trying to do? You're talking like you're trying >> to read an existing RFC822 email-with-headers from a file, but you're >> showing code that creates a new email with body content set from >> a file, which is a completely different thin

Re: Users banned

2018-07-17 Thread Jon Ribbens
On 2018-07-17, Steven D'Aprano wrote: > But neither of these are prohibited by the CoC, neither of these should > be banning offense, and even if they were, he should have had a formal > warning first. > > Preferably TWO formal warnings: the first privately, the second publicly, > and only on t

Re: Users banned

2018-07-17 Thread Jon Ribbens
On 2018-07-17, Thomas Jollans wrote: > On 2018-07-16 01:29, Jon Ribbens wrote: >> Do you have any reason to believe the message at the top of the >> thread purporting to ban users was genuinely from the moderators? >> Because there are obvious reasons to believe otherwise.

Re: Cookies not showing up in environ

2018-07-21 Thread Jon Ribbens
On 2018-07-20, abc abc wrote: > Well, I'm so messed up between so many sources and tutorials I don't > know which way is up. I think one of the main issues is that you don't seem to have decided whether you're writing a WSGI application or a Django application. WSGI: def application(enviro

Re: Cookies not showing up in environ

2018-07-21 Thread Jon Ribbens
On 2018-07-21, abc abc wrote: >> I think one of the main issues is that you don't seem to have decided >> whether you're writing a WSGI application or a Django application. > > Yes, I suppose I thought Django had to use wsgi to process requests, > I didn't know there were 'two' options here. Djan

Re: Pylint false positives

2018-08-14 Thread Jon Ribbens
On 2018-08-14, Steven D'Aprano wrote: > If there really are a lot of such missing methods, I'd consider writing > something like this: > > class A: > def __init__(self, ...): > ... > > # === process abstract methods en masse === > for name in "method_a method_b method_c method

Re: Pylint false positives

2018-08-15 Thread Jon Ribbens
On 2018-08-15, Steven D'Aprano wrote: > On Tue, 14 Aug 2018 15:18:13 +0000, Jon Ribbens wrote: >> On 2018-08-14, Steven D'Aprano >> wrote: >>> # === process abstract methods en masse === >>> for name in "method_a method_b method_

Re: Pylint false positives

2018-08-17 Thread Jon Ribbens
On 2018-08-17, Steven D'Aprano wrote: > On the other hand, your objection to the following three idioms is as > good an example of the Blurb Paradox as I've ever seen. Do you mean the Blub Paradox? If so, you're misunderstanding or at least misapplying it. >> * code running directly under the

Re: [OT] master/slave debate in Python

2018-09-25 Thread Jon Ribbens
On 2018-09-25, Chris Angelico wrote: > On Tue, Sep 25, 2018 at 11:01 PM Calvin Spealman wrote: >> This entire conversation is inappropriate for this mailing list. Please >> leave this free for people who need to ask and give help with Python, >> regardless of which side of this argument you are o

Re: [OT] master/slave debate in Python

2018-09-25 Thread Jon Ribbens
On 2018-09-25, Chris Angelico wrote: > On Wed, Sep 26, 2018 at 1:56 AM Jon Ribbens wrote: >> Those things might be on topic on python-dev - although I am sure >> no-one would thank you for continuing this discussion there - but >> this is comp.lang.python/python-list and h

Re: So apparently I've been banned from this list

2018-10-01 Thread Jon Ribbens
On 2018-10-01, Roel Schroeven wrote: > I'm not very active here, but I've been lurking for years. In my eyes > Steven has always been active and helpful. Now he has *once* been a > *tiny bit* rude, and he's banned for that? It's not "once", it's a long-standing pattern of behaviour. > As far a

Untrusted code execution

2016-04-03 Thread Jon Ribbens
I'd just like to say up front that this is more of a thought experiment than anything else, I don't have any plans to use this idea on any genuinely untrusted code. Apart from anything else, there's the denial-of-service issue. That said, is there any way that the following Python 3.4 code could r

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-03, Jon Ribbens wrote: > I'd just like to say up front that this is more of a thought experiment > than anything else, I don't have any plans to use this idea on any > genuinely untrusted code. Apart from anything else, there's the > denial-of-service issue.

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-05, Rustom Mody wrote: > On Tuesday, April 5, 2016 at 7:19:39 PM UTC+5:30, Jon Ribbens wrote: >> On 2016-04-03, Jon Ribbens wrote: >> > I'd just like to say up front that this is more of a thought experiment >> > than anything else, I don't h

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-05, Chris Angelico wrote: > On Wed, Apr 6, 2016 at 12:50 AM, Ian Kelly wrote: >> Same here, although it looks to me like this approach could work. Or >> I'm just not clever enough to see how it could be exploited. > > Having been bitten in the past (our test box was compromised by > py

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-05, Chris Angelico wrote: > On Wed, Apr 6, 2016 at 3:26 AM, Jon Ribbens > wrote: >> The received wisdom is that restricted code execution in Python is >> an insolubly hard problem, but it looks a bit like my 7-line example >> above disproves this theory, provi

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-05, Chris Angelico wrote: > You can also create objects of various types using literal/display > syntax, and that might let you craft some weird construct that > effectively access those attributes without actually having an > attribute that starts with an underscore. (Think of "getattr

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-05, Jon Ribbens wrote: > On 2016-04-05, Chris Angelico wrote: >> Your code is a *lot* safer for using 'eval' rather than 'exec'. >> Otherwise, you'd be easily exploited using exceptions, which carry a >> ton of info. > > ... but all

Re: Untrusted code execution

2016-04-05 Thread Jon Ribbens
On 2016-04-05, Paul Rubin wrote: > Jon Ribbens writes: >>> isinstance(node, ast.Attribute) and node.attr.startswith("_")): >>> raise ValueError("Access to private values is not allowed.") >>> namespace = {&

  1   2   3   4   5   6   7   >