Re: uses both shell and python codes in one script.

2019-10-03 Thread Cameron Simpson
On 04Oct2019 09:17, Chris Angelico wrote: On Fri, Oct 4, 2019 at 9:13 AM Cameron Simpson wrote: If we're going to accept the approach though, I'd rather the shebang was just "#!/bin/sh". There's _always_ a /bin/sh, and a number of BSDish systems do not have a /usr/bin/env (it tends to land in

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Fri, Oct 4, 2019 at 9:13 AM Cameron Simpson wrote: > > On 04Oct2019 03:34, Chris Angelico wrote: > >On Fri, Oct 4, 2019 at 12:15 AM James Lu wrote: > >> I would use IPython as a scripting language. It has a slow startup > >> time though. > >> > >And how, in the messy world of cross-platform s

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Fri, Oct 4, 2019 at 9:08 AM Cameron Simpson wrote: > > On 03Oct2019 23:55, Chris Angelico wrote: > >On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: > >> I'm very confusing on the following part in this script: > >> > >> > >> ''':' # begin python string; this line is interpreted by the

Re: uses both shell and python codes in one script.

2019-10-03 Thread Cameron Simpson
On 04Oct2019 03:34, Chris Angelico wrote: On Fri, Oct 4, 2019 at 12:15 AM James Lu wrote: I would use IPython as a scripting language. It has a slow startup time though. And how, in the messy world of cross-platform scripting, would you locate the interpreter? The whole point of this script

Re: uses both shell and python codes in one script.

2019-10-03 Thread Cameron Simpson
On 03Oct2019 23:55, Chris Angelico wrote: On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: I'm very confusing on the following part in this script: ''':' # begin python string; this line is interpreted by the shell as `:` which python >/dev/null 2>&1 && exec python "$0" "$@" which py

Re: how can i run python script in spamassassin

2019-10-03 Thread Skip Montanaro
Check out SpamBayes. It runs on Linux and is written in Python. Like Spamassasin, it has no plugin architecture, but perhaps you'll discover you don't need it, or can more easily tweak SpamBayes to call your external script. Skip On Thu, Oct 3, 2019, 2:15 PM Doris Marca Guaraca wrote: > > Hell

Re: how can i run python script in spamassassin

2019-10-03 Thread Michael Torrie
On 10/3/19 1:10 PM, Doris Marca Guaraca wrote: > > Hello, I'm sorry to bother you, I just reviewed this post, the Python > beginner, the Linux beginner, needs to run spamassassin, and now I'm trying > to do something very similar with a Python script is for a project, maybe you > can help me th

how can i run python script in spamassassin

2019-10-03 Thread Doris Marca Guaraca
Hello, I'm sorry to bother you, I just reviewed this post, the Python beginner, the Linux beginner, needs to run spamassassin, and now I'm trying to do something very similar with a Python script is for a project, maybe you can help me thanks. I appreciate it a lot. Regards Doris -- https:

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Fri, Oct 4, 2019 at 12:15 AM James Lu wrote: > > I would use IPython as a scripting language. It has a slow startup time > though. > And how, in the messy world of cross-platform scripting, would you locate the interpreter? The whole point of this script is to attempt three different shebangs,

Re: uses both shell and python codes in one script.

2019-10-03 Thread Michael Torrie
On 10/3/19 8:15 AM, James Lu wrote: > I would use IPython as a scripting language. It has a slow startup time > though. Lately I've been using Xonsh, which is a much more comfortable application of Python to shell scripting than anything else I've tried. Occasionally subprocess mode selection vs P

Re: uses both shell and python codes in one script.

2019-10-03 Thread James Lu
I would use IPython as a scripting language. It has a slow startup time though. On Thu, Oct 3, 2019 at 9:59 AM Chris Angelico wrote: > On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: > > > > On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > > > > > > > Seems fine. Most of the code

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: > > On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > > > > Seems fine. Most of the code is elsewhere, and presumably has been > > written to support both Py2 and Py3; the file you're linking to is > > *just* a wrapper that finds an inte

Re: uses both shell and python codes in one script.

2019-10-03 Thread Hongyi Zhao
On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > Seems fine. Most of the code is elsewhere, and presumably has been > written to support both Py2 and Py3; the file you're linking to is > *just* a wrapper that finds an interpreter to use. > > Though this should be unnecessary. A simple

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Thu, Oct 3, 2019 at 10:51 PM Hongyi Zhao wrote: > > See this file: > > https://github.com/hongyi-zhao/dotbot/blob/master/bin/dotbot > > It uses both shell and python codes in one script, is this good practice? Seems fine. Most of the code is elsewhere, and presumably has been written to suppor

uses both shell and python codes in one script.

2019-10-03 Thread Hongyi Zhao
See this file: https://github.com/hongyi-zhao/dotbot/blob/master/bin/dotbot It uses both shell and python codes in one script, is this good practice? -- https://mail.python.org/mailman/listinfo/python-list

Re: pathlib

2019-10-03 Thread Richard Damon
On 10/2/19 6:27 PM, DL Neil via Python-list wrote: > On 3/10/19 3:07 AM, Rhodri James wrote: >> On 02/10/2019 09:14, DL Neil via Python-list wrote: >>> That said, it is one of the ways that a path can be shown to >>> transition from some 'pure' state to become 'concrete'. >>> >>> However, A.N.Other

Re: pathlib

2019-10-03 Thread Dan Sommers
On 10/2/19 6:58 PM, DL Neil via Python-list wrote: > On 3/10/19 12:42 AM, Dan Sommers wrote: > Certainly, although some may have quietly given-up talking to a > non-OOP native - and one so 'slow', I am appreciative of all > help-given! I also speak OO as a second language (usually kicking, screa

Re: Basic python question

2019-10-03 Thread Peter Otten
Jagga Soorma wrote: > Thanks again Aldwin. This seems to work, guess it is the set that is > flipping the numbers: > > x,y = (output.split()) The parens on the right are superfluous: >>> a, b = "foo bar".split() >>> a 'foo' >>> b 'bar' > inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -