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

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

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