RE: Class initialization with multiple inheritance

2019-07-20 Thread Joseph L. Casale
-Original Message- From: Barry Scott Sent: Tuesday, July 16, 2019 11:53 AM To: Joseph L. Casale Cc: python-list@python.org Subject: Re: Class initialization with multiple inheritance > And here is the MRO for LeftAndRight. > > >>> import m > LeftAndRight.__init__() > Left.__init__() > R

How to execute shell command in Python program?

2019-07-20 Thread Madhavan Bomidi
Hi, I have the following shell commands to run my executable created with gfortran: - $ pwd /OPAC/opac31a/opac31 $ ls extback.dat opacopac.f result terr.dat input opac.cfg

Re: How to execute shell command in Python program?

2019-07-20 Thread Chris Narkiewicz via Python-list
Madhavan Bomidi wrote: > import subprocess > subprocess.call(['./opac'],shell=True) subprocess.call(['./opac', "my-input.inp"], shell=True) The array takes command with a list of arguments. This way you don't need to do space escaping and other Jujitsu gimmicks. If you want to feed the command f

Re: How to execute shell command in Python program?

2019-07-20 Thread Peter J. Holzer
On 2019-07-20 15:39:58 +0100, Chris Narkiewicz via Python-list wrote: > Madhavan Bomidi wrote: > > import subprocess > > subprocess.call(['./opac'],shell=True) There may be an os.chdir() missing here. > subprocess.call(['./opac', "my-input.inp"], shell=True) We don't know whether the OP's progra

Proper shebang for python3

2019-07-20 Thread Manfred Lotz
Hi there, Pretty new to python I've got a question regarding the proper shebang for Python 3. I use #!/usr/bin/python3 which works fine. Today I saw #!/usr/bin/python3 -tt and was wondering what -tt means. Being on Fedora 30, Python 3.7.3 the man page of python3 doesn't even mention -t

Re: Proper shebang for python3

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 3:41 AM Manfred Lotz wrote: > > Hi there, > Pretty new to python I've got a question regarding the proper shebang > for Python 3. > > I use >#!/usr/bin/python3 > > which works fine. > > Today I saw >#!/usr/bin/python3 -tt > > and was wondering what -tt means. > > Be

Re: Proper shebang for python3

2019-07-20 Thread Manfred Lotz
On Sun, 21 Jul 2019 03:44:24 +1000 Chris Angelico wrote: > On Sun, Jul 21, 2019 at 3:41 AM Manfred Lotz > wrote: > > > > Hi there, > > Pretty new to python I've got a question regarding the proper > > shebang for Python 3. > > > > I use > >#!/usr/bin/python3 > > > > which works fine. > > > >

Re: Proper shebang for python3

2019-07-20 Thread Michael Speer
You may want to use `#!/usr/bin/env python3` instead. There is a concept in python called the virtual environment. This used to be done with a tool called virtualenv in python2, and is now done mainly through a venv module in python3. A virtual environment goes into a directory of your choosing a

Re: Proper shebang for python3

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 4:13 AM Michael Speer wrote: > > You may want to use `#!/usr/bin/env python3` instead. > > There is a concept in python called the virtual environment. This used to > be done with a tool called virtualenv in python2, and is now done mainly > through a venv module in python3

Re: Embedding Python in C

2019-07-20 Thread Stefan Behnel
Jesse Ibarra schrieb am 20.07.19 um 04:12: > Sorry, I am not understanding. Smalltlak VW 8.3 does not support Python. > I can only call Pyhton code through C/Python API. Ok, but that doesn't mean you need to write code that uses the C-API of Python. All you need to do is: 1) Start up a CPython ru

Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 1:20 PM, Chris Angelico wrote: > On Sun, Jul 21, 2019 at 4:13 AM Michael Speer wrote: >> >> You may want to use `#!/usr/bin/env python3` instead. >> >> There is a concept in python called the virtual environment. This used to >> be done with a tool called virtualenv in python2, and is n

Re: Proper shebang for python3

2019-07-20 Thread Manfred Lotz
On Sat, 20 Jul 2019 14:11:21 -0400 Michael Speer wrote: > You may want to use `#!/usr/bin/env python3` instead. > In my case it doesn't matter. However, I agree that your suggestion is usually preferable. > There is a concept in python called the virtual environment. This > used to be done wit

Re: Proper shebang for python3

2019-07-20 Thread Peter J. Holzer
On 2019-07-20 14:11:44 -0500, Tim Daneliuk wrote: > So, no, do NOT encode the hard location - ever. Always use env to > discover the one that the user has specified. The only exception is > /bin/sh which - for a variety of reasons - can reliably counted upon. > > We don't need to bikeshed this.

Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 2:56 PM, Peter J. Holzer wrote: > On 2019-07-20 14:11:44 -0500, Tim Daneliuk wrote: >> So, no, do NOT encode the hard location - ever. Always use env to >> discover the one that the user has specified. The only exception is >> /bin/sh which - for a variety of reasons - can reliably cou

Re: Proper shebang for python3

2019-07-20 Thread Brian Oney via Python-list
On Sat, 2019-07-20 at 15:26 -0500, Tim Daneliuk wrote: > On 7/20/19 2:56 PM, Peter J. Holzer wrote: > > On 2019-07-20 14:11:44 -0500, Tim Daneliuk wrote: > > > So, no, do NOT encode the hard location - ever. Always use env to > > > discover the one that the user has specified. The only exception

Re: How to execute shell command in Python program?

2019-07-20 Thread DL Neil
On 21/07/19 5:07 AM, Peter J. Holzer wrote: On 2019-07-20 15:39:58 +0100, Chris Narkiewicz via Python-list wrote: Madhavan Bomidi wrote: import subprocess subprocess.call(['./opac'],shell=True) There may be an os.chdir() missing here. subprocess.call(['./opac', "my-input.inp"], shell=True)

Re: Proper shebang for python3

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 5:26 AM Tim Daneliuk wrote: > So, no, do NOT encode the hard location - ever. Always use env to discover > the one that > the user has specified. The only exception is /bin/sh which - for a variety > of reasons - > can reliably counted upon. A quick grep through my $PA

Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 5:14 PM, Chris Angelico wrote: > Using env for everything is a terrible idea and one that > will basically make virtual environments useless. Not if you manage them properly. Everyone's mileage is different, but when I enter a venv, I ensure everything I do there is packaged to work t

Re: Proper shebang for python3

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 8:56 AM Tim Daneliuk wrote: > > On 7/20/19 5:14 PM, Chris Angelico wrote: > > Using env for everything is a terrible idea and one that > > will basically make virtual environments useless. > > Not if you manage them properly. > > Everyone's mileage is different, but when I

Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 5:47 PM, Tim Daneliuk wrote: > On 7/20/19 5:14 PM, Chris Angelico wrote: >> Using env for everything is a terrible idea and one that >> will basically make virtual environments useless. > > Not if you manage them properly. > > Everyone's mileage is different, but when I enter a venv, I

Re: Proper shebang for python3

2019-07-20 Thread Cameron Simpson
On 21Jul2019 08:14, Chris Angelico wrote: On Sun, Jul 21, 2019 at 5:26 AM Tim Daneliuk wrote: So, no, do NOT encode the hard location - ever. Always use env to discover the one that the user has specified. The only exception is /bin/sh which - for a variety of reasons - can reliably counte

Re: Proper shebang for python3

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 9:15 AM Cameron Simpson wrote: > > On 21Jul2019 08:14, Chris Angelico wrote: > >On Sun, Jul 21, 2019 at 5:26 AM Tim Daneliuk wrote: > >> So, no, do NOT encode the hard location - ever. Always use env to > >> discover the one that > >> the user has specified. The only e

Namespaces: memory vs 'pollution'

2019-07-20 Thread DL Neil
How do you remember to from-import- 'everything' that is needed? I have a 'utility module' which contains a bunch of classes which examine/check/log aspects of the execution environment. One of which is PythonEnvironment, another relates to the HostSystem (as examples). They are most-frequent

Re: Proper shebang for python3

2019-07-20 Thread Cameron Simpson
On 21Jul2019 09:31, Chris Angelico wrote: On Sun, Jul 21, 2019 at 9:15 AM Cameron Simpson wrote: So you mean that a tool that depends on running on a consistent environment, it should use a shebang of "/usr/bin/python3.6" instead of "/usr/bin/env python3"? Jeez. No. That is the _opposite_

How to print out html tags excluding the attributes

2019-07-20 Thread sum abiut
I want to use regular expression to print out the HTML tags excluding the attributes. for example: import re html = 'Hitest test' tags = re.findall(r'<[^>]+>', html) for a in tags: print(a) the output is : But I just want the tag, not the attributes -- https://mail.python.or

Re: How to print out html tags excluding the attributes

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 11:06 AM sum abiut wrote: > > I want to use regular expression to print out the HTML tags excluding the > attributes. I'll just leave this here... https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags No, I won't be that cruel

SCons 3.1.0 Released

2019-07-20 Thread Bill Deegan
A new SCons checkpoint release, 3.1.0, is now available on the SCons download page: https://scons.org/pages/download.html SCons is an Open Source software construction tool—that is, a next-generation build tool. Think of SCons as an improved, cross-platform substitute for the classic

Re: Proper shebang for python3

2019-07-20 Thread Manfred Lotz
On Sat, 20 Jul 2019 23:28:35 +0200 Brian Oney wrote: > Why not make a compromise? What would be a potential pitfall of the > following spitbang? > > #!python I think that per definition a path in a shebang has to be absolute. Actually, your suggestion won't work for people who use the fish she

Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 6:04 PM, Chris Angelico wrote: > Are you aware of every systemwide command that happens to be > implemented in Python, such that you won't execute any of them while > you have the venv active? No, but this has never been a problem because the newer versions of python tend to be pretty g

Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 6:04 PM, Cameron Simpson wrote: > If you require a specific outcoming, set a specific environment. It is under  > your control. Control it. Exactly right. I have just had the REALLY irritating experience of trying to bootstrap a location insensitive version of linuxbrew that mostly wo

Re: Proper shebang for python3

2019-07-20 Thread Chris Angelico
On Sun, Jul 21, 2019 at 3:41 PM Tim Daneliuk wrote: > > On 7/20/19 6:04 PM, Chris Angelico wrote: > > Are you aware of every systemwide command that happens to be > > implemented in Python, such that you won't execute any of them while > > you have the venv active? > > No, but this has never been