Re: python3 subprocess run sudo cmd in remote failed

2019-09-16 Thread Chris Angelico
On Tue, Sep 17, 2019 at 3:25 PM Cameron Simpson wrote: > However, I repeat my recommendation to use a keypair for the > authentication, as it avoids needing interactive passwords (and having > your programme know the password has its own suite of problems to do > with where that password comes fro

Re: python3 subprocess run sudo cmd in remote failed

2019-09-16 Thread Cameron Simpson
On 17Sep2019 13:02, lampahome wrote: Note also that since stdin and stdout are pipes and not the terminal then ssh will not be interactive, and will not allocate a tty at the far end either. You can get ssh to open a remote tty with the -t option. But I suspect you don't want stdin=PIPE or stdo

Re: python3 subprocess run sudo cmd in remote failed

2019-09-16 Thread lampahome
> > Well, there's a Python library called "paramiko" which implements ssh. > That might help. > > Later I will try lol. > Note also that since stdin and stdout are pipes and not the terminal > then ssh will not be interactive, and will not allocate a tty at the far > end either. You can get ssh t

Re: python3 subprocess run sudo cmd in remote failed

2019-09-16 Thread Cameron Simpson
On 17Sep2019 12:13, lampahome wrote: Hello, I use python3.5 and found no way to solve this problem from subprocess import Popen, PIPE ps = Popen('ssh -o \'StrictHostKeyChecking no\' hello@192.168.80.11 \'sudo sysctl -w vm.drop_caches=3\', stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=0, shell

python3 subprocess run sudo cmd in remote failed

2019-09-16 Thread lampahome
Hello, I use python3.5 and found no way to solve this problem >from subprocess import Popen, PIPE >ps = Popen('ssh -o \'StrictHostKeyChecking no\' hello@192.168.80.11 \'sudo sysctl -w vm.drop_caches=3\', stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=0, shell=True) > hello@192.168.80.11's password

Re: Irritating bytearray behavior

2019-09-16 Thread MRAB
On 2019-09-17 02:37, Ian Pilcher wrote: I am using a bytearray to construct a very simple message, that will be sent across the network. The message should always be 20 bytes: 2 bytes - address family (AF_INET or AF_INET6) - network byte order 2 bytes - (padding) 4 or 16 bytes - IP

Re: Irritating bytearray behavior

2019-09-16 Thread Cameron Simpson
On 16Sep2019 20:37, Ian Pilcher wrote: msg[4:] = ip.packed sock.sendto(msg, dest) This doesn't work in the IPv4 case, because the bytearray gets truncated to only 8 bytes (4 bytes plus the size of ip.packed). Is there a way to avoid this behavior copy the contents of ip.packed into the byt

Re: re not working

2019-09-16 Thread MRAB
On 2019-09-17 02:31, CrazyVideoGamez wrote: For some reason these are different: pattern = r'[0-9]{4,6}' And pattern2 = r'[0-9][0-9][0-9][0-9]([0-9]){0,2}' And when I try to match them import re re.search(pattern, '1234') and import re re.search(pattern2, '1234') are different. Help? Pyt

Irritating bytearray behavior

2019-09-16 Thread Ian Pilcher
I am using a bytearray to construct a very simple message, that will be sent across the network. The message should always be 20 bytes: 2 bytes - address family (AF_INET or AF_INET6) - network byte order 2 bytes - (padding) 4 or 16 bytes - IP address The size of the IP address is dependen

re not working

2019-09-16 Thread CrazyVideoGamez
For some reason these are different: pattern = r'[0-9]{4,6}' And pattern2 = r'[0-9][0-9][0-9][0-9]([0-9]){0,2}' And when I try to match them import re re.search(pattern, '1234') and import re re.search(pattern2, '1234') are different. Help? -- https://mail.python.org/mailman/listinfo/pytho

Something faster than turtle

2019-09-16 Thread Tintin
Hi, I'm novice in Python. I'm trying to draw with turtle but it's really slow (even with speed("fastest")). Comparing to Scratch, it's really slow. 1/ Are there solutions to get things faster ? 2/ Are there any other tools such as turtle but (really) faster ? Thanks. -- https://mail.python.

Re: OT: Using a fake Gmail address is probably not a good idea

2019-09-16 Thread Max Zettlmeißl via Python-list
On Mon, Sep 16, 2019 at 1:56 PM Skip Montanaro wrote: > Mails for someone here who goes by the handle "ast" with a fake > address of n...@gmail.com keep landing in my Gmail spam folder. I > suspect the same is true for all people subscribed to python-list who > use Gmail. Gmail (correctly, I think

RE: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread wesley
Hi exit (http://docs.python.org/2/library/constants.html#exit"; rel="noreferrer) is an alias for quit (or vice-versa). They exist together simply to make Python more user-friendly. please refer: https://stackoverflow.com/questions/19747371/python-exit-commands-why-so-ma

Re: TechRepublicDEVELOPERCXO JPMorgan's Athena has 35 million lines of Python code, and won't be updated to Python 3 in time

2019-09-16 Thread Chris Angelico
On Mon, Sep 16, 2019 at 4:38 AM Spencer Graves wrote: > >Is anyone interested in contacting these companies -- or the > companies from which they buy cybersecurity insurance -- and inviting > them to provide paid staff to maintain 2.7 and to offer further offer > consulting services to hel

Re: numpy results in segmentation fault

2019-09-16 Thread Test Bot
Firstly, in response to this " I tried to install numpy with 3.7.3 and it is for some reason not working and after import when I run import numpy at python console and press enter I get >>? i,e its not working properly. " the >> prompt after import numpy signifies that the numpy module has been lo

Re: Strange Class definition

2019-09-16 Thread Peter Otten
ast wrote: > Hello > > Following syntax doesn't generate any errors: > > >>> foo=0 > >>> Class Foo: > foo > > But class Foo seems empty > > Is it equivalent to ? > > >>> class Foo: > pass The resulting class is equivalent, but the expression `foo` is actually evaluated d

Re: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Eryk Sun
On 9/16/19, Hongyi Zhao wrote: > > What is the Difference Between quit() and exit() commands in Python? They're different instances of the Quitter class, which is available if site.py is imported (i.e. not with the -S command-line option). They're created by site.setquit(): def setquit():

Strange Class definition

2019-09-16 Thread ast
Hello Following syntax doesn't generate any errors: >>> foo=0 >>> Class Foo: foo But class Foo seems empty Is it equivalent to ? >>> class Foo: pass -- https://mail.python.org/mailman/listinfo/python-list

Re: What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Peter Otten
Hongyi Zhao wrote: > What is the Difference Between quit() and exit() commands in Python? They are instances of the same type >>> import inspect >>> type(quit) is type(exit) True >>> print(inspect.getsource(type(quit))) class Quitter(object): def __init__(self, name, eof): self.name

What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Hongyi Zhao
What is the Difference Between quit() and exit() commands in Python? -- https://mail.python.org/mailman/listinfo/python-list

Fwd: numpy results in segmentation fault

2019-09-16 Thread Thomas Jollans
Please reply on-list. (both of you) Forwarded Message Subject:Re: numpy results in segmentation fault Date: Mon, 16 Sep 2019 17:04:57 +0530 From: Test Bot To: Pradeep Patra CC: Thomas Jollans Firstly, in response to this " I tried to install numpy with

OT: Using a fake Gmail address is probably not a good idea

2019-09-16 Thread Skip Montanaro
(I would have sent this off-list, but for obvious reasons I couldn't.) Mails for someone here who goes by the handle "ast" with a fake address of n...@gmail.com keep landing in my Gmail spam folder. I suspect the same is true for all people subscribed to python-list who use Gmail. Gmail (correctly

Re: numpy results in segmentation fault

2019-09-16 Thread Pradeep Patra
Yes it is crashing in the hackerrank site and the testcases fails with segmentation fault. I tried to install numpy with 3.7.3 and it is for some reason not working and after import when I run import numpy at python console and press enter I get >>? i,e its not working properly. Can you please hel

Re: kmeans clustering

2019-09-16 Thread Pankaj Jangid
Sharan Basappa writes: > Can someone please help me to clarify the different between fit and > predict functions of kmeans? > What is the significance of `predict' in K-means? It is an unsupervised clustering algorithm. My intuition says that the cluster composition itself might change if you add