Re: Find the path of a shell command [POSTPONED]

2022-10-12 Thread Cameron Simpson
On 13Oct2022 03:25, Paulo da Silva wrote: There is another problem involved. The script, works fine except when launched by cron! Why? Record the script output: # record all output exec >/tmp/script.$$.out 2>&1 # dump the envionment env | sort # turn on execution tracing

Re: Find the path of a shell command [POSTPONED]

2022-10-12 Thread Paulo da Silva
Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty wel

Re: Find the path of a shell command

2022-10-12 Thread rbowman
On 10/12/22 09:06, Chris Green wrote: Michael F. Stemper wrote: On 12/10/2022 07.20, Chris Green wrote: jak wrote: Il 12/10/2022 09:40, jkn ha scritto: On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: I'm afraid you will have to look for the command in every path listed in

Re: for -- else: what was the motivation?

2022-10-12 Thread dn
On 11/10/2022 02.13, Grant Edwards wrote: On 2022-10-10, Chris Angelico wrote: On Mon, 10 Oct 2022 at 11:52, MRAB wrote: On 2022-10-10 00:40, dn wrote: On Sun, 9 Oct 2022 at 15:39, Axy via Python-list wrote: "shortest block first" Have never heard this advice before. Kind-of rankled

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
On 2022-10-11 14:11:56 -0400, Thomas Passin wrote: > To bring things back to the context of the original post, actual web > browsers are extremely tolerant of HTML syntax errors (including incorrect > nesting of tags) in the documents they receive. HTML5 actually specifies exactly how to recover f

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
On 2022-10-13 11:23:40 +1100, Chris Angelico wrote: > On Thu, 13 Oct 2022 at 11:19, Peter J. Holzer wrote: > > On 2022-10-11 09:47:52 +1100, Chris Angelico wrote: > > > On Tue, 11 Oct 2022 at 09:18, Cameron Simpson wrote: > > > > > > > Consider: > > > > > > if condition # no colon > > > code

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Chris Angelico
On Thu, 13 Oct 2022 at 11:23, dn wrote: > # add an extra character within identifier, as if 'new' identifier > 28 assert expected_value == fyibonacci_number > UUU > > # these all trivial SYNTAX errors - could have tried leaving-out a > keyword,

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Chris Angelico
On Thu, 13 Oct 2022 at 11:19, Peter J. Holzer wrote: > > On 2022-10-11 09:47:52 +1100, Chris Angelico wrote: > > On Tue, 11 Oct 2022 at 09:18, Cameron Simpson wrote: > > > > > Consider: > > > > if condition # no colon > > code > > else: > > code > > > > To actually "restart" parsing, you

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread dn
On 09/10/2022 23.09, Antoon Pardon wrote: I would like a tool that tries to find as many syntax errors as possible in a python file. I know there is the risk of false positives when a tool tries to recover from a syntax error and proceeds but I would prefer that over the current python strategy

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
On 2022-10-11 09:47:52 +1100, Chris Angelico wrote: > On Tue, 11 Oct 2022 at 09:18, Cameron Simpson wrote: > > > Consider: > > if condition # no colon > code > else: > code > > To actually "restart" parsing, you have to make a guess of some sort. Right. At least one of the papers on par

Re: Find the path of a shell command

2022-10-12 Thread Joe Pfeiffer
Cameron Simpson writes: > On 12Oct2022 20:54, Jon Ribbens wrote: >>On 2022-10-12, Jon Ribbens wrote: >>> On 2022-10-12, Joe Pfeiffer wrote: Jon Ribbens writes: > on Amazon Linux: > > $ which rm > /usr/bin/rm > $ sudo which rm > /bin/rm Ha

Re: Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Às 22:38 de 12/10/22, Jon Ribbens escreveu: On 2022-10-12, Jon Ribbens wrote: On 2022-10-12, Paulo da Silva wrote: Às 19:14 de 12/10/22, Jon Ribbens escreveu: On 2022-10-12, Paulo da Silva wrote: Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the fu

Re: for -- else: what was the motivation?

2022-10-12 Thread Peter J. Holzer
On 2022-10-10 16:48:04 +, Robert Latest via Python-list wrote: > Axy wrote: > >> Also not really a justification for "shortest block first". Wanting > >> some elaboration on that. What's the value in it? > > > > Well, the value is productivity. No need to save puzzles "what this > > hanging el

Re: for -- else: what was the motivation?

2022-10-12 Thread Peter J. Holzer
On 2022-10-10 10:11:10 +, Stefan Ram wrote: > I would not use tabs in source code as they are not > displayed in the same way everywhere. Some would argue that this is a feature. Different people prefer different indentation widths. Using a single tab character for an indentation level all

Re: Find the path of a shell command

2022-10-12 Thread Peter J. Holzer
On 2022-10-12 21:51:39 +0100, Paulo da Silva wrote: > Às 19:14 de 12/10/22, Jon Ribbens escreveu: > > If you're using subprocess.run / subprocess.Popen then the computer is > > *already* searching PATH for you. > Yes, and it works out of cron. > > Your problem must be that your cron > > job is bein

Re: Find the path of a shell command

2022-10-12 Thread Cameron Simpson
On 12Oct2022 20:54, Jon Ribbens wrote: On 2022-10-12, Jon Ribbens wrote: On 2022-10-12, Joe Pfeiffer wrote: Jon Ribbens writes: on Amazon Linux: $ which rm /usr/bin/rm $ sudo which rm /bin/rm Have some major Linux distributions not done usrmerge yet? For any that have,

Re: Find the path of a shell command

2022-10-12 Thread Cameron Simpson
On 13Oct2022 08:50, Cameron Simpson wrote: On 12Oct2022 15:16, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: rm doesn't take that long. Why are you detaching them? [...] For remove filesystems, even a local to your LAN NAS, it can take quite a while. Of course I meant "remote" h

Re: Find the path of a shell command (shutil.which)

2022-10-12 Thread Eryk Sun
On 10/12/22, Weatherby,Gerard wrote: > > When no path is specified, the results of > os.environ() are used, > returning either the “PATH” value or a fallback of > os.defpath. The documentat

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Jon Ribbens wrote: > On 2022-10-12, Paulo da Silva wrote: >> Às 19:14 de 12/10/22, Jon Ribbens escreveu: >>> On 2022-10-12, Paulo da Silva wrote: Às 05:00 de 12/10/22, Paulo da Silva escreveu: > Hi! > > The simple question: How do I find the full path of a shell c

Re: Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Eryk Sun
On 10/12/22, Kirill Ratkin via Python-list wrote: > > Do anyone face issue like in log below? > > I got last installer (3.10.8) and try to install it 'for all users' with > downloading precompiled (pdb) files. There was a permission problem on the Python website that prevented downloading the 3.8

Re: Find the path of a shell command

2022-10-12 Thread Cameron Simpson
On 12Oct2022 15:16, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: rm doesn't take that long. Why are you detaching them? For big things it takes quite a while. On slow discs it can take quite a while. For directory trees with many files it can take quite a while. For remove filesy

Re: Find the path of a shell command (shutil.which)

2022-10-12 Thread Weatherby,Gerard
Not going to do any good if it’s not on the PATH in the first place: https://docs.python.org/3/library/shutil.html shutil.which(cmd, mode=os.F_OK | os.X_OK, path=None) Return the path to an executable which would be run if the given cmd was called. If no cmd would be called, return None. mode is

Re: Find the path of a shell command

2022-10-12 Thread Cameron Simpson
On 12Oct2022 17:49, Paulo da Silva wrote: Às 05:00 de 12/10/22, Paulo da Silva escreveu: I think that the the suggestion of searching the PATH env seems the best. I just want to note that you want to not just check for existence of the path, but that it is executable (permissionwise). You wa

Re: Find the path of a shell command

2022-10-12 Thread Thomas Passin
On 10/12/2022 12:00 AM, Paulo da Silva wrote: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty well

Re: Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Thomas Passin
You probably need to install from an administrator account to install for all users. On 10/12/2022 5:20 AM, Kirill Ratkin via Python-list wrote: Hi All, Do anyone face issue like in log below? I got last installer (3.10.8) and try to install it 'for all users' with downloading precompiled (

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 19:14 de 12/10/22, Jon Ribbens escreveu: >> On 2022-10-12, Paulo da Silva wrote: >>> Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain t

Re: Find the path of a shell command

2022-10-12 Thread Weatherby,Gerard
Some thoughts / notes: 1. On our Ubuntu-Server 20.04.3 based systems, /bin/rm and /usr/bin/rm are hard links to the same file. 2. Put the following in a bash script and run it from cron. Then you can see what your environment is. Mine has PATH=/usr/bin:/bin in it. #!/bin/bash env > /tmp/env$$

Re: Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Às 20:09 de 12/10/22, Antoon Pardon escreveu: Op 12/10/2022 om 18:49 schreef Paulo da Silva: Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 20:19, MRAB ha scritto: On 2022-10-12 06:11, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reaso

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Jon Ribbens wrote: > On 2022-10-12, Joe Pfeiffer wrote: >> Jon Ribbens writes: >> >>> On 2022-10-12, Michael F. Stemper wrote: On 12/10/2022 07.20, Chris Green wrote: > ... and rm will just about always be in /usr/bin. On two different versions of Ubuntu, it's

Re: Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Às 19:14 de 12/10/22, Jon Ribbens escreveu: On 2022-10-12, Paulo da Silva wrote: Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line?

Re: Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Às 20:16 de 12/10/22, 2qdxy4rzwzuui...@potatochowder.com escreveu: On 2022-10-12 at 17:43:18 +0100, Paulo da Silva wrote: Às 17:22 de 12/10/22, Tilmann Hentze escreveu: Paulo da Silva schrieb: I have python program that launches a detached rm. It works pretty well until it is invoked by cro

Re: for -- else: what was the motivation?

2022-10-12 Thread Weatherby,Gerard
As did I. tree = ET.parse(lfile) for child in tree.getroot(): if child.tag == 'server': break else: raise ValueError(f"server tag not found in {lfile}") I think there are other places I could be using it, but honestly I t

Re: Find the path of a shell command

2022-10-12 Thread Grant Edwards
On 2022-10-12, 2qdxy4rzwzuui...@potatochowder.com <2qdxy4rzwzuui...@potatochowder.com> wrote: > On 2022-10-12 at 17:43:18 +0100, Paulo da Silva > wrote: >> >> > Probably you could use os.unlink[1] with no problem. >> >> No, because I need to launch several rm's that keep running after the script

Re: Find the path of a shell command

2022-10-12 Thread 2QdxY4RzWzUUiLuE
On 2022-10-12 at 17:43:18 +0100, Paulo da Silva wrote: > Às 17:22 de 12/10/22, Tilmann Hentze escreveu: > > Paulo da Silva schrieb: > > > I have python program that launches a detached rm. It works pretty well > > > until it is invoked by cron! I suspect that for cron we need to specify > > > th

Re: Find the path of a shell command

2022-10-12 Thread Antoon Pardon
Op 12/10/2022 om 18:49 schreef Paulo da Silva: Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python progra

Re: Find the path of a shell command

2022-10-12 Thread jkn
On Wednesday, October 12, 2022 at 12:07:36 PM UTC+1, jak wrote: > Il 12/10/2022 09:40, jkn ha scritto: > > On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: > >> Il 12/10/2022 06:00, Paulo da Silva ha scritto: > >>> Hi! > >>> > >>> The simple question: How do I find the full path

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 05:00 de 12/10/22, Paulo da Silva escreveu: >> Hi! >> >> The simple question: How do I find the full path of a shell command >> (linux), i.e. how do I obtain the corresponding of, for example, >> "type rm" in command line? >> >> The reason: >> I have py

Re: Find the path of a shell command

2022-10-12 Thread MRAB
On 2022-10-12 06:11, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Joe Pfeiffer wrote: > Jon Ribbens writes: > >> On 2022-10-12, Michael F. Stemper wrote: >>> On 12/10/2022 07.20, Chris Green wrote: ... and rm will just about always be in /usr/bin. >>> >>> On two different versions of Ubuntu, it's in /bin. >> >> It will almost always be in /

Re: Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Às 17:22 de 12/10/22, Tilmann Hentze escreveu: Paulo da Silva schrieb: I have python program that launches a detached rm. It works pretty well until it is invoked by cron! I suspect that for cron we need to specify the full path. Probably you could use os.unlink[1] with no problem. No, becaus

Re: Find the path of a shell command

2022-10-12 Thread Joe Pfeiffer
Jon Ribbens writes: > On 2022-10-12, Michael F. Stemper wrote: >> On 12/10/2022 07.20, Chris Green wrote: >>> ... and rm will just about always be in /usr/bin. >> >> On two different versions of Ubuntu, it's in /bin. > > It will almost always be in /bin in any Unix or Unix-like system, > because

Re: How to fix Python error, The term '.../python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program, in VS Code?

2022-10-12 Thread Dennis Lee Bieber
On Tue, 11 Oct 2022 16:40:31 -0700, LouisAden Capellupo declaimed the following: > So basically, I get, "The term '...\python.exe' is not recognized as the >name of a cmdlet, function, script, file, or operable program... At line: 1 >char: 3." It works the first way I showed with Code Runne

Re: Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty wel

Re: Find the path of a shell command

2022-10-12 Thread Michael F. Stemper
On 12/10/2022 07.20, Chris Green wrote: jak wrote: Il 12/10/2022 09:40, jkn ha scritto: On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: I'm afraid you will have to look for the command in every path listed in the PATH environment variable. erm, or try 'which rm' ? You mig

Re: Find the path of a shell command

2022-10-12 Thread Chris Green
Michael F. Stemper wrote: > On 12/10/2022 07.20, Chris Green wrote: > > jak wrote: > >> Il 12/10/2022 09:40, jkn ha scritto: > >>> On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: > > I'm afraid you will have to look for the command in every path listed in > the PATH envi

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Michael F. Stemper wrote: > On 12/10/2022 07.20, Chris Green wrote: >> ... and rm will just about always be in /usr/bin. > > On two different versions of Ubuntu, it's in /bin. It will almost always be in /bin in any Unix or Unix-like system, because it's one of the fundamental util

Re: Cannot import gdal in jupyter notebook

2022-10-12 Thread Abdul Haseeb Azizi
On Wednesday, October 12, 2022 at 9:51:22 AM UTC+2, Abdul Haseeb Azizi wrote: > On Tuesday, October 11, 2022 at 10:29:34 PM UTC+2, MRAB wrote: > > On 2022-10-11 20:38, Thomas Passin wrote: > > > On Windows, when I tried to install gdal using pip, it needed to compile > > > part of it. I'm not se

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 14:20, Chris Green ha scritto: jak wrote: Il 12/10/2022 09:40, jkn ha scritto: On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. h

Re: Find the path of a shell command

2022-10-12 Thread Chris Green
jak wrote: > Il 12/10/2022 09:40, jkn ha scritto: > > On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: > >> Il 12/10/2022 06:00, Paulo da Silva ha scritto: > >>> Hi! > >>> > >>> The simple question: How do I find the full path of a shell command > >>> (linux), i.e. how do I obtain th

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 09:40, jkn ha scritto: On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm"

Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Kirill Ratkin via Python-list
Hi All, Do anyone face issue like in log below? I got last installer (3.10.8) and try to install it 'for all users' with downloading precompiled (pdb) files. And installation fails saying permission error. Installer says downloading error in the log. I repeated it three times with same re

Re: Find the path of a shell command

2022-10-12 Thread jkn
On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: > Il 12/10/2022 06:00, Paulo da Silva ha scritto: > > Hi! > > > > The simple question: How do I find the full path of a shell command > > (linux), i.e. how do I obtain the corresponding of, for example, > > "type rm" in command lin

Re: Cannot import gdal in jupyter notebook

2022-10-12 Thread Abdul Haseeb Azizi
On Tuesday, October 11, 2022 at 10:29:34 PM UTC+2, MRAB wrote: > On 2022-10-11 20:38, Thomas Passin wrote: > > On Windows, when I tried to install gdal using pip, it needed to compile > > part of it. I'm not set up with the Microsoft compiler and header > > files, so that failed. If you are on W

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty we

Find the path of a shell command

2022-10-12 Thread Paulo da Silva
Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty well until it is invoked by cron! I suspect that f

Re: flattening lists

2022-10-12 Thread Antoon Pardon
Op 11/10/2022 om 21:32 schreef SquidBits _: Does anyone else think there should be a flatten () function, which just turns a multi-dimensional list into a one-dimensional list in the order it's in. e.g. [[1,2,3],[4,5,6,7],[8,9]] becomes [1,2,3,4,5,6,7,8,9]. I have had to flatten lists quite