Re: revisiting the "What am I running on?" question

2019-02-19 Thread eryk sun
On 2/19/19, Chris Angelico wrote: > > The value "win32" means Windows (or, more technically, "Windows NT > family", as opposed to Win95/Win98 - but since Win XP, that's the only > type of Windows there is). If you actually care about whether it's a > 32-bit or 64-bit OS, you can look at sys.maxsiz

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread eryk sun
On 2/19/19, Chris Angelico wrote: > > I guess you have to define the question better for Windows, since > there's no single definition of "executable". If you mean "typing just > the base name of this file at the shell will result in it being run", > then PATHEXT is the correct answer. If you mean

Re: Feature suggestions: "Using declarations" i.e. context managers ("with" blocks) tied to scope/lifetime of the variable rather than to nesting

2019-02-19 Thread Ben Finney
"mnl.p...@gmail.com" writes: > with xx.open() as logfile: > do this > do that > logfile.write() > do this > do that > logfile.write() That's a good sign you have identified a discrete collection of statements that should be in a function. The function accepts ‘l

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Grant Edwards
On 2019-02-19, MRAB wrote: > On 2019-02-19 18:31, Grant Edwards wrote: > >> FWIW, I've noticed that afer downloading a .exe under Linux and >> scp'ing the file to a Windows machine, it wont run when double-clicked >> until I fire up a Cygwin shell and do a >> >> chmod +x .exe >> >> [I assume

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 6:29 AM Terry Reedy wrote: > > On 2/19/2019 10:06 AM, Chris Angelico wrote: > > On Wed, Feb 20, 2019 at 2:04 AM Chris Angelico wrote: > >> > >> On Wed, Feb 20, 2019 at 1:59 AM songbird wrote: > >>> > >>> MRAB wrote: > >>> ... > Don't use a bare except, it'll catch _a

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Terry Reedy
On 2/19/2019 10:06 AM, Chris Angelico wrote: On Wed, Feb 20, 2019 at 2:04 AM Chris Angelico wrote: On Wed, Feb 20, 2019 at 1:59 AM songbird wrote: MRAB wrote: ... Don't use a bare except, it'll catch _any_ exception. that's ok with this code IMO, but i see your point. Not really, n

Re: WebScrapping

2019-02-19 Thread Adrian Ordona
Thanks Piet for the quick response. Yes, i was running it line by line. When i ran >>> len(containers), the output is giving me 37 but when i ran the code as a py file, it was only showing one result. Thanks in advance. Adrian On Feb 19, 2019, at 4:38 AM, Piet van Oostrum wrote: > Adrian Ordo

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread MRAB
On 2019-02-19 18:31, Grant Edwards wrote: On 2019-02-19, Chris Angelico wrote: On Wed, Feb 20, 2019 at 5:05 AM Dennis Lee Bieber wrote: On 19 Feb 2019 13:58:18 GMT, jureq declaimed the following: >> I could also use the 2 first bytes of a file and determine if the file >> is a binary becau

Re: ajax with pyside webview

2019-02-19 Thread Abdur-Rahmaan Janhangeer
Great, yes Qt webview with pyside. well for backend, flask for front end using Jquery to fetch items i implemented an instant search. on the browser when i type, i get results. on the webview, as i type, i get no results. serverside logs tell no ajax request has been made, i assume a js block s

Aw: Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Karsten Hilbert
> I guess you have to define the question better for Windows, since > there's no single definition of "executable". If you mean "typing just > the base name of this file at the shell will result in it being run", > then PATHEXT is the correct answer. If you mean "this thing is > actually inherently

Re: ajax with pyside webview

2019-02-19 Thread Bob Gailer
I assume you are referring to QT webview. "ajax via jquery does not work." Can you be more specific? what is the evidence that it's not working? It sounds like you've got a server running on your Local Host. What does the server tell you about its side of that Ajax request? -- https://mail.pyth

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Grant Edwards
On 2019-02-19, Chris Angelico wrote: > On Wed, Feb 20, 2019 at 5:05 AM Dennis Lee Bieber > wrote: >> >> On 19 Feb 2019 13:58:18 GMT, jureq declaimed the >> following: >> >> >> I could also use the 2 first bytes of a file and determine if the file >> >> is a binary because on Windows, the execut

Re: What's the address for?

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 5:28 AM Grant Edwards wrote: > > On 2019-02-19, Chris Angelico wrote: > > On Wed, Feb 20, 2019 at 3:23 AM Grant Edwards > > wrote: > > > >> Those object _may_ each have different identies. Is it required that > >> they do? If an assignment is done on name referring to

Re: What's the address for?

2019-02-19 Thread Grant Edwards
On 2019-02-19, Chris Angelico wrote: > On Wed, Feb 20, 2019 at 3:23 AM Grant Edwards > wrote: > >> Those object _may_ each have different identies. Is it required that >> they do? If an assignment is done on name referring to an object with >> no other references, would it be allowed that the

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 5:05 AM Dennis Lee Bieber wrote: > > On 19 Feb 2019 13:58:18 GMT, jureq declaimed the > following: > > >> I could also use the 2 first bytes of a file and determine if the file > >> is a binary because on Windows, the executable files start with b'MZ'. > > > >Is .bat execu

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 3:26 AM Grant Edwards wrote: > > On 2019-02-19, Chris Angelico wrote: > > > Oh, and not just bugs either. If the user hits Ctrl-C at just the > > right moment, KeyboardInterrupt will be raised. You'll swallow that > > exception silently, preventing the user-requested halt,

Re: What's the address for?

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 3:23 AM Grant Edwards wrote: > > On 2019-02-19, Ben Finney wrote: > > >> On the implementation I am using, the ID changes if I do this: > > > > You are creating new objects and binding the name ‘a’ to different > > objects in succession. Those different objects will each h

Re: Feature suggestions: "Using declarations" i.e. context managers ("with" blocks) tied to scope/lifetime of the variable rather than to nesting

2019-02-19 Thread Thomas Jollans
On 19/02/2019 05.15, mnl.p...@gmail.com wrote: > This becomes more ugly if multiple withs get nested. > This is what contextlib.ExitStack is for. -- https://mail.python.org/mailman/listinfo/python-list

Re: The NaNny State

2019-02-19 Thread Rhodri James
On 18/02/2019 23:24, Avi Gross wrote: Ben asked: Who says that the “correct spelling in python is all lower case "nan"”? Fair enough. Except for reserved words in the language, all we have is hints of what the designers used. The reality is that whoever codes the __str__ and/or __repr__ chos

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Grant Edwards
On 2019-02-19, Chris Angelico wrote: > Oh, and not just bugs either. If the user hits Ctrl-C at just the > right moment, KeyboardInterrupt will be raised. You'll swallow that > exception silently, preventing the user-requested halt, and going and > doing the wrong thing. Don't use a bare except c

Re: What's the address for?

2019-02-19 Thread Grant Edwards
On 2019-02-19, Ben Finney wrote: >> On the implementation I am using, the ID changes if I do this: > > You are creating new objects and binding the name ‘a’ to different > objects in succession. Those different objects will each have different > identities. Those object _may_ each have different

Re: Feature suggestions: "Using declarations" i.e. context managers ("with" blocks) tied to scope/lifetime of the variable rather than to nesting

2019-02-19 Thread Neil Cerutti
On 2019-02-19, mnl.p...@gmail.com wrote: > I thought this new C# feature would be a good thing to add to Python: > https://vcsjones.com/2019/01/30/csharp-8-using-declarations/ > > I find the nesting required by context managers to be at odds with the > broad intent. > > The code indentation in pyt

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Rhodri James
On 19/02/2019 14:35, songbird wrote: Dan Sommers wrote: ... Python 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127] on linux Type "help", "copyright", "credits" or "license" for more information. import sys sys.platform 'linux' this doesn't help me for the rest of the platforms

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 1:59 AM songbird wrote: > > MRAB wrote: > ... > > Don't use a bare except, it'll catch _any_ exception. > > that's ok with this code IMO, but i see your point. > Not really, no. It means that ANY bug (barring an outright syntax error) inside the try block will silently m

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 2:04 AM Chris Angelico wrote: > > On Wed, Feb 20, 2019 at 1:59 AM songbird wrote: > > > > MRAB wrote: > > ... > > > Don't use a bare except, it'll catch _any_ exception. > > > > that's ok with this code IMO, but i see your point. > > > > Not really, no. It means that ANY

Re: revisiting the "What am I running on?" question

2019-02-19 Thread Chris Angelico
On Wed, Feb 20, 2019 at 1:51 AM songbird wrote: > For other systems, the values are: > System platform value > Linux 'linux' > Windows 'win32' > Windows/Cygwin 'cygwin' > Mac OS X'darwin' > > = > > no win64? The value "win32" means Windows (or, more technically,

Re: Gtk. GUI app pgming

2019-02-19 Thread songbird
nn wrote: > > any gtk+ III.buffs around ? > > am gonna launch a hot new newsreader soon. works like a charm. i used python 3, gtk3 (PyGObject which brings you pycairo) and pyglet for a quick game and it went ok. the issues i have now are with the actual distribution to all the platfor

Re: revisiting the "What am I running on?" question

2019-02-19 Thread songbird
MRAB wrote: ... > Don't use a bare except, it'll catch _any_ exception. that's ok with this code IMO, but i see your point. > If the regex matches, re.search will return a match object; if it > doesn't match, it'll return None. > > In any case, +1 to Dan's answer. > > [snip] ok, thanks!

Re: revisiting the "What am I running on?" question

2019-02-19 Thread songbird
Rick Johnson wrote: ... > The standard idiom for regexp match objects is to test for truthiness, not to > use an except-clause. > > m = re.search("^[A-Za-z]:", sysprobetmp) > if m: > ... ok, thanks! :) songbird -- https://mail.python.org/mailman/listinfo/python-list

Re: revisiting the "What am I running on?" question

2019-02-19 Thread songbird
Dan Sommers wrote: ... > Python 3.7.2 (default, Jan 10 2019, 23:51:51) > [GCC 8.2.1 20181127] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> sys.platform > 'linux' this doesn't help me for the rest of the platforms available. = fro

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread bryan rasmussen
Well, I used to know the answer to this question but I haven't done this kind of thing since 2009, so hopefully what I suggest is not out of date, so for everything I say here assume I put provisos in like it used to be or whatever. Anyway if the type of a file is executable , for example a file w

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread jureq
> I could also use the 2 first bytes of a file and determine if the file > is a binary because on Windows, the executable files start with b'MZ'. Is .bat executable? -- https://mail.python.org/mailman/listinfo/python-list

Re: ajax with pyside webview

2019-02-19 Thread Abdur-Rahmaan Janhangeer
you mean? Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

RE: ajax with pyside webview

2019-02-19 Thread Steve
Try BonAmi. Footnote: Ultrasound Technician Asks Pregnant Woman If She'd Like To Know Baby's Name -Original Message- From: Python-list On Behalf Of Abdur-Rahmaan Janhangeer Sent: Tuesday, February 19, 2019 2:08 AM To: Python Subject: ajax with pyside webview greetings, i'm using pys

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Stephane Wirtel
And based on a determinist solution? Yes, you can check the extension but sometimes I prefer to be sure. For example, the API of Win32 has the GetTypeBinaryW function, this one could be used but I need to create a mapping, with CPython api, ctypes or CFFI. I could also use the 2 first bytes of

Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Igor Korot
Hi, On Tue, Feb 19, 2019 at 7:26 AM Stephane Wirtel wrote: > > Hi all, > > on Linux/Unix/BSD, we can detect if a file is an executable with > os.access(path, os.X_OK) but this is not the case on Windows. > > Do you have an idea? Check file extension? Thank you. > > Have a nice day, > > Stéphan

Re: trying to begin a code for web scraping

2019-02-19 Thread Joel Goldstick
On Tue, Feb 19, 2019 at 12:52 AM Drake Gossi wrote: > > Hi everyone, > > I'm trying to write code to scrape this website > ( > regulations.gov) of its comments, but I'm having trouble figuring out what > to link onto in the inspect pag

How to detect if a file is executable on Windows?

2019-02-19 Thread Stephane Wirtel
Hi all, on Linux/Unix/BSD, we can detect if a file is an executable with os.access(path, os.X_OK) but this is not the case on Windows. Do you have an idea? Have a nice day, Stéphane -- Stéphane Wirtel - https://wirtel.be - @matrixise -- https://mail.python.org/mailman/listinfo/python-list

Re: WebScrapping

2019-02-19 Thread Piet van Oostrum
Adrian Ordona writes: > Hi, > > I’m learning how to code and interested in web scrapping to gather data. > I’m running on Mac OS X 10.9.5 and python 3.7 terminal. > I’m trying to capture the name of the brand and price but i keep getting an > error (see below). > Traceback (most recent call last

Re: Feature suggestions: "Using declarations" i.e. context managers ("with" blocks) tied to scope/lifetime of the variable rather than to nesting

2019-02-19 Thread Rhodri James
This is probably better discussed on python-ideas, but here goes: On 19/02/2019 04:15, mnl.p...@gmail.com wrote: I thought this new C# feature would be a good thing to add to Python: https://vcsjones.com/2019/01/30/csharp-8-using-declarations/ I find the nesting required by context managers to

Feature suggestions: "Using declarations" i.e. context managers ("with" blocks) tied to scope/lifetime of the variable rather than to nesting

2019-02-19 Thread mnl.p...@gmail.com
I thought this new C# feature would be a good thing to add to Python: https://vcsjones.com/2019/01/30/csharp-8-using-declarations/ I find the nesting required by context managers to be at odds with the broad intent. The code indentation in python should reflect the program logic and flow as much