I've Been stuck here for days. I want to copy a file from my windows to a remote linux server and run the script there. I've tool for ssh and scp. from which I can call the linux server through command line but when I call it through python it gets hanged.
pro=subprocess.Popen('ssh [email protected]') pro.communicate()
there is a blank screen. whatever I type then after appear to my screen. I was hoping there should be a password prompt but there isn't any. I thought of using library like paramiko, pexpect, pyssh but none of them are supported in Python 3
Any help is highly appreciated.
I'm not sure it can be converted by 2to3
but it's rather simple to use:
from fabric.api import run, env from fabric.context_managers import hide from fabric.colors import green with hide('status', 'running', 'output'): print('Apache ' + env.host + ': ' + green(run('wget -q -O /dev/null http://localhost/ && echo OK')))
env.host comes from command line, twisted couch is another alternative but it's not yet ported to py3k