Re: Is it dangeous when using custom metaclass?
dieter at 2018/10/17 UTC+8 PM 1:15:01 wrote: > jf...@ms4.hinet.net writes: > > Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote > >> jf...@ms4.hinet.net wrote: > >> > class Structure(metaclass=StructureMeta): ... > >> > > >> > class PolyHeader(Structure): ... > >> > > >> > As my understanding, the metaclass's __init__ was called when a class was > >> > created. In the above example, both the Structure and PolyHeader called > >> > it. > >> > My question is: because the PolyHeader inherited Structure, is it > >> > reasonable > >> > for PolyHeader to call this __init__ again? Will it cause any possible > >> > trouble? > >> > >> It's reasonable for both to call it, because they're distinct > >> instances of StructureMeta, each of which need to be initialised. > > > > The PolyHeader is already initialized by inheritance. Is there any way to > > bypass this __init__? > > If there were any, you should find it described in metaclass related > documentation. > > Likely, you can ensure that followup calls of "__init__" effectively > behave as "no-op"s: let the first call place a marker in the initialized > object and check in later calls whether it is already there. Hard to find the document of type.__init__. I can only guess it does nothing, at least no thing serious, to avoid trouble the metaclass's __init__ may cause in a class hierarchy:-) -- https://mail.python.org/mailman/listinfo/python-list
SSHLibrary (PyNaCl and Cryptography) inst for Python 3.6.4 in Windows 10
Hi Has somebody been able to install SSHLIbrary from sources (all libs with offline installations) on virtual Win 10 for Python 3.6.4? Python 3.6.4 ... [MSC v. 1900 64 bit (AMD 64)] Also Microsoft Visual Studio 2017 is installed (also vc_redist.x64.exe) SSHLinrary worked with Python 2.7 (there wasn't so many dependencies) SSHLIbrary 3.3.1 requires paramiko paramiko-2.4.2.tar.gz requires bcrypt,cryptography, pynacl and pyasn1 and cffi is needed Problems are with PyNaCl-1.3.0.tar.gz and cryptography-2.1.4.tar.gz Installing PyNaCl C:\Tools\PyNaCl-1.3.0>python setup.py install >> log.txt warning: no previously-included files matching '__pycache__\*' found anywhere in distribution warning: no previously-included files matching '.tarvis.yml' etc.. File "setup.py", line 159, in run raise Exception("ERROR": The 'make' utility is missing from PATH") Exception: ERROR: The 'make' utility is missing from PATH Installation of cryptography ends to C:\Program Files (x86)\Microsoft Visual Studio\2017\VC\Tools\MSVC14.11.25503\bin\HostX86\x64\cl.exe /c /nologo / build\temp.win-amd64-3.6\Release\_openssl.c(493): fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory Hoping that somebody can help and sorry that I didn't feel to write hole messages because development env has connections to web BR Saila -- https://mail.python.org/mailman/listinfo/python-list
Re: check whether a process is still running on remote hosts
On Tuesday, October 16, 2018 at 2:14:26 PM UTC-7, tina_z...@yahoo.com wrote: > I newly learned Python, and I need to wrap up a script to do following. > > Env: > 1: One launcher Linux VM (from where to run the Python script) > 2. 100+ Linux VM > > requirement: > In general, run a remote_script on remote 100 VMs and get the log files > generated to remote hosts back to launcher. > > steps > 1. cp (pexpect.spawn('scp ')) supporting files including the remote_script > to remotehost:/remote_folder > 2. run remote_script on remote host ( pexpect.spawn('ssh %s@%s "%s"' % > (user,host,cmd)) > 3. wait and check until the remote_script was run on remote host. (to check > "ps -ef" result on remote hosts) > 4. collect data from remote hosts -- reverse to step 1. > > > I briefly implemented other steps expect step 3. Two options are below. > > option 1: run another script "ps -ef|grep remote_script and output result to > a local file, then collected the files to launcher. > > option 2: run pexect.spawn('ssh' 'ps -e') to get the result directly to > laucher console. > But how I can get only the output for "ps -ef" command only? > > I must use the (users, passwords, and hosts) way to do ssh and scp because I > may not be allowed to use ssh key on some hosts. Any suggestions or sample > code for step 3 or the whole script are appreciated. Thanks. Thanks everyone's comments and suggestions! I will give ansible a try later. As for now, I'm coding the scripts myself as a practice to brush up my Python skill. -- https://mail.python.org/mailman/listinfo/python-list
Re: SSHLibrary (PyNaCl and Cryptography) inst for Python 3.6.4 in Windows 10
On 2018-10-17 16:41, Saila wrote: > Hi > Has somebody been able to install SSHLIbrary from sources (all libs with > offline installations) on virtual Win 10 for Python 3.6.4? > > Python 3.6.4 ... [MSC v. 1900 64 bit (AMD 64)] > > Also Microsoft Visual Studio 2017 is installed (also vc_redist.x64.exe) > > SSHLinrary worked with Python 2.7 (there wasn't so many dependencies) > > SSHLIbrary 3.3.1 requires paramiko > paramiko-2.4.2.tar.gz requires bcrypt,cryptography, pynacl and pyasn1 > and cffi is needed > Problems are with PyNaCl-1.3.0.tar.gz and cryptography-2.1.4.tar.gz > > Installing PyNaCl > C:\Tools\PyNaCl-1.3.0>python setup.py install >> log.txt > warning: no previously-included files matching '__pycache__\*' found anywhere > in distribution > warning: no previously-included files matching '.tarvis.yml' > etc.. >File "setup.py", line 159, in run > raise Exception("ERROR": The 'make' utility is missing from PATH") > Exception: ERROR: The 'make' utility is missing from PATH > > Installation of cryptography > ends to > C:\Program Files (x86)\Microsoft Visual > Studio\2017\VC\Tools\MSVC14.11.25503\bin\HostX86\x64\cl.exe /c /nologo / > build\temp.win-amd64-3.6\Release\_openssl.c(493): fatal error C1083: Cannot > open include file: 'openssl/opensslv.h': No such file or directory > > Hoping that somebody can help and sorry that I didn't feel to write hole > messages because development env has connections to web > BR > Saila > Can't you just install it with pip? py -3 -m pip install PyNaCl -- https://mail.python.org/mailman/listinfo/python-list
Advice on law firm
Anyone know a good US based law firm that specializes in software licenses and class action suits? Sent from Mail for Windows 10 -- https://mail.python.org/mailman/listinfo/python-list
RE: Advice on law firm
Correction: specializing in warranty of merchantability, software licenses, and possibly class action suits. Sent from Mail for Windows 10 From: Ryan Johnson Sent: Wednesday, October 17, 2018 9:26 PM To: python-list@python.org Subject: Advice on law firm Anyone know a good US based law firm that specializes in software licenses and class action suits? Sent from Mail for Windows 10 -- https://mail.python.org/mailman/listinfo/python-list
Re: Is it dangeous when using custom metaclass?
jf...@ms4.hinet.net writes: > ... > Hard to find the document of type.__init__. I can only guess it does nothing, > at least no thing serious, to avoid trouble the metaclass's __init__ may > cause in a class hierarchy:-) You always have the possibility to look at the source. All classes have common attributes "__bases__", "__module__", "__name__", "__dict__", They must come from somewhere. "type.__init__" could be this place. -- https://mail.python.org/mailman/listinfo/python-list
namedtuples anamoly
Hi, I tried using namedtuples and just found a behaviour which I am not able to conclude as correct behaviour. from collections import namedtuple (n, categories) = (int(input()), input().split()) Grade = namedtuple('Grade', categories) Grade.ID = 1 #print(Grade.ID) ob = Grade(10, 50) print(ob.ID) print(ob.MARKS) ob1 = Grade(20, 100) print(ob1.ID) 2 ID MARKS 1 50 1 100 If we set GRADE.ID =1 , it has impact on all variables. Is this behaviour just like class variable and it has global scope. I expected ob.ID and ob1.ID to be 10. Correct me if Iam wrong. Appreciate any quick response. Kind Rgds, Vinu -- https://mail.python.org/mailman/listinfo/python-list
Re: SSHLibrary (PyNaCl and Cryptography) inst for Python 3.6.4 in Windows 10
keskiviikko 17. lokakuuta 2018 20.18.55 UTC+3 Thomas Jollans kirjoitti: > On 2018-10-17 16:41, Saila wrote: > > Hi > > Has somebody been able to install SSHLIbrary from sources (all libs with > > offline installations) on virtual Win 10 for Python 3.6.4? > > > > Python 3.6.4 ... [MSC v. 1900 64 bit (AMD 64)] > > > > Also Microsoft Visual Studio 2017 is installed (also vc_redist.x64.exe) > > > > SSHLinrary worked with Python 2.7 (there wasn't so many dependencies) > > > > SSHLIbrary 3.3.1 requires paramiko > > paramiko-2.4.2.tar.gz requires bcrypt,cryptography, pynacl and pyasn1 > > and cffi is needed > > Problems are with PyNaCl-1.3.0.tar.gz and cryptography-2.1.4.tar.gz > > > > Installing PyNaCl > > C:\Tools\PyNaCl-1.3.0>python setup.py install >> log.txt > > warning: no previously-included files matching '__pycache__\*' found > > anywhere in distribution > > warning: no previously-included files matching '.tarvis.yml' > > etc.. > >File "setup.py", line 159, in run > > raise Exception("ERROR": The 'make' utility is missing from PATH") > > Exception: ERROR: The 'make' utility is missing from PATH > > > > Installation of cryptography > > ends to > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\VC\Tools\MSVC14.11.25503\bin\HostX86\x64\cl.exe /c /nologo > > / build\temp.win-amd64-3.6\Release\_openssl.c(493): fatal error C1083: > > Cannot open include file: 'openssl/opensslv.h': No such file or directory > > > > Hoping that somebody can help and sorry that I didn't feel to write hole > > messages because development env has connections to web > > BR > > Saila > > > > Can't you just install it with pip? > > py -3 -m pip install PyNaCl That is not possible because there isn't connection to www in development environment. It is isolated. Only possiblity is import sources. -- https://mail.python.org/mailman/listinfo/python-list